IRC channel logs
2016-11-20.log
back to list of logs
<nee`>I suspect that it's connected to xml->sxml, because I wrote something similiar with guile-json before and didn't have any problems. <amz3>taylan: what do you recommend to use to delcare a callback function inside a scheme bytestructure? <kristofer>I've been trying to hook into the jack server, but I can't figure out why jack-callback crashes the client <kristofer>do I need to define-wrapped-pointer-type so the gc doesn't take the procedure-pointer out of memory? <taylan>amz3: functions can't be serialized into bytes, so that wouldn't work <taylan>amz3: or did you mean it in a different way? <wingo>maybe next year someone will get on that ;) <wingo>i guess pepole should implement more opinionated parallelism and concurrency libraries before such a book can be written tho <kristofer>amz3: there is procedure->pointer in (system foreign) <taylan>amz3: my OS crashed so in case you replied to my latest message I didn't see it <amz3>taylan: how do you declare a pointer in a struct? I think it depends on the architecture so I'm not sure what to use <amz3>basically I need (bs:pointer ,void) <amz3>I'm wondering what do to for notify_cb and notify_payload <taylan>amz3: hm, not sure what to use for something that should have pointer size. best I can think of is (bs:pointer (bs:pointer uint8)) <taylan>that will make sure that the bytevector pointed to has at least the size of a pointer <kristofer>I'm trying to get this procedure->pointer to return a 0. I speculate the 0 in guile is different than an int in c. I've tried a range of things, like (define zero (make-bitvector (sizeof int) #x0)) or just #x0, but the procedure->pointer is always non-zero when the callback is executed <taylan>kristofer: I don't understand. why should procedure->pointer return 0? <kristofer>the c function that calls my procedure->pointer expects a 0 <taylan>kristofer: do I understand it correctly that you create a C function by using procedure->pointer, and you want that C function to return the C int value 0? <taylan>kristofer: I don't think that would work. since procedure->pointer takes a Scheme procedure, the resulting C function will necessarily return a value of type SCM <kristofer>procedure->pointer specifies a return type.. am I misunderstanding how that works? <kristofer>(procedure->pointer int (lambda (x) (+ x 1)) (list int)) <taylan>kristofer: you're right. if the scheme procedure returns the Scheme integer 0, then the C function should return 0 I suppose <taylan>ACTION forgot that the FFI did stuff like that <kristofer>that's what I gather from the tests. I'm trying to register a callback with libjack, but my callback is returning non-zero and I can't figure out why <kristofer>or it hangs because of some latency issue and jack boots my client. I don't know how to tell :-/ <taylan>kristofer: have you tried to figure out what value the original Scheme procedure returns? you may be able to do it easily by using the 'pk' function; just wrap an expression in it to debug-output an intermediate value, like (lambda (x) (pk (* x 2))) is effectively the same as (lambda (x) (* x 2)) but outputs the value before returning it <mistnim>anybody else running guile from org babel? Right now when there is an error in the code it just tells me so without any explanation. Does that happen to you? <amz3>mistnim: what is org babel? <amz3>kristofer: the callback is called by libjack, and that's libjack that expects 0? <kristofer>in particular, the jack_set_process_callback <kristofer>outside of the jack_set_process_callback, my guile jack client connects to jack, sets up the ports properly, and even activates. the callback is literally (lambda () 0) <amz3>sorry, I never encountered this issue <amz3>kristofer: did you try to define the procedure instead of using a anonymous lambda? <kristofer>ACTION wonders if the pointer->procedure is prematurely gc'd <kristofer>I thought that might prevent it from being gc'd <kristofer>I wrap the callback functions with define-wrapped-pointer-type <amz3>I think you don't need to wrap it <amz3>just pass the reuslt of procedure->pointer <amz3>(disclaimer those are wild guess) <amz3>ah ok so unwrap be before submiting it to jack <amz3>what the C side is receiving <amz3>kristofer: I will create a small C shared library that prints the output of the callback and see what happens <kristofer>yeah, I thought using a wrapped pointer might prevent GC, but that assumes that the procedure being GC'd is the problem <amz3>sirgazil: are you working a web framework? :) <sirgazil>amz3: well, I call it that, I use it on my website. I'm trying to use the concepts form Django, but for static sites. <sirgazil>kristofer: yes, it's written with guile, but is not for the general public, I'm not a trained programmer. I model my programs with a machete :) <sirgazil>Yes, and I will probably move to it in the future. But currently, the code I have works for me :) <kristofer>in my guile web adventure I've found both haunt and guix-web to be inspirational <guile-guest3>I am getting this error while compiling guile 2.0.13 on macOS Sierra <guile-guest3> CCLD libguile-2.0.la Undefined symbols for architecture x86_64: "_clock_getcpuclockid", referenced from: _scm_init_stime in libguile_2.0_la-stime.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) <sirgazil>kristofer: sure. They are written by a trained programmer :) <amz3>guile-guest3: AFAIK nobody use guile on macos <amz3>sirgazil: don't be modest... <guile-guest3>i need it to support one of the dependencies of another program .... <sirgazil>And I was wondering what would you use in guile to do something similar. <amz3>kristofer: I made a small experiment and procedure->pointer does return an integer <amz3>kristofer: look at the bottom <amz3>sirgazil: I was experimenting with scheme in the browser :D <amz3>sirgazil: also the app I am prototyping might interest you <amz3>sirgazil: it's a palette creator <amz3>wait I will put it online in a minute <daviid>is there an option somwhere so that repl evaluation would not print the full results for (long) lists and (very big) vectors? <wingo>you can set the repl-printer somehow <wingo>ACTION just ran a test that spawned 1e6 fibers that all were trying to write a single message on the same channel, then the main fiber read out 1e6 messages <daviid>wingo: hey! yes, I have a proble wrt guile-cv, because anything kills emacs! and it is very easy to forget to (define image (im0load ...)) boum!!!! <ft>Could that also be used to print integers in base 16 or something else? <wingo>took about 23 seconds, max heap size 433 MB, 4.5 seconds to spawn then the rest to read and do the context switches <daviid>wingo: the repl-printer? you mean write my own? <wingo>i'm pretty satisfied with that for now, until we do native compilation anyway <wingo>daviid: yes you could use truncated-print or whatever that thing is <wingo>search the manual for truncate <wingo>clearly indicates both that having 1e6 threads running concurrently is fine from a memory POV, and that the fibers channel mechanism isn't terrible, even with the concurrent ml overhead <wingo>compares OK to haskell's thing; around 5x or 10x slower but i don't know how much of that is related to bytecode vs native code <wingo>and no need to tune per-thread stack sizes <daviid>I can't find repl-printer in the source, where is that defined? <daviid>pfut! repl-print in (system repl common) I guess