***catonano_ is now known as catonano
***sm2n_ is now known as sm2n
***rekado_ is now known as rekado
<rekado>hmm, I must be missing something. I put everything in a global guardian but sometimes it crashes and sometimes it doesn’t. <rekado>according to gdb the crash happens when the library tries to copy the vector. <mwette>Ah, in the manual the copied string generated by string->pointer is freed when the pointer becomes unreachable. I think we need to change make-cstr-array to take an array of pointers and use (make-cstr-array/ptr (map string->pointer str-list)) <mwette>Well, (define spl (map string->pointer str-list)) (my-guardian spl) ... <rekado>I’ve done that but it doesn’t seem to make a difference <rekado>(I put everything in that global guardian: the pointers, the strings, the list of strings, the addresses, the bytevector itself) <mwette>there are undocumented commands gc-enable and gc-disable, I just saw in the sources <rekado>with gc-disable at the beginning of the file it does not crash, even when calling the C procedure 100 times <rekado>it does crash when the file has just been modified and needs to be compiled <rekado>but after auto-compilation: no crashes <libfud>is there a generic string conversion function? <libfud>hey, I recognize you from #lua, you get around <RhodiumToad>it looks like display is actually the primitive, and if you want a string representation of the result you wrap it using call-with-output-string <RhodiumToad>using a string port like that is how (format #f ...) works for example *RhodiumToad doesn't get around all that much, just has an interest in languages, especially embeddable ones <libfud>I think it's actually with-output-to-string, but I could be doing this wrong <RhodiumToad>(define (obj->string obj) (call-with-output-string (cut display obj <>))) <RhodiumToad>(define (obj->string obj) (call-with-output-string (lambda (port) (display obj port)))) <libfud>almost all of my use of scheme has been in the context of the REPL and doing pretty simple things <RhodiumToad>with-output-to-string is similar, but has to use a dynamic context to change the default output port <RhodiumToad>whereas call-with-output-string just passes the new string port to the function <libfud>is there an "assert" function or macro defined in any of the srfi or ice modules? <RhodiumToad>(define (assert-fail e) (error (format #f "Assertion failed: ~A" e))) <RhodiumToad>(define-syntax-rule (assert e) (unless e (assert-fail (quote e)))) <libfud>ah, I didn't know about unless either <libfud>so it's just that the price of object->string is probably significantly higher than <type>->string <RhodiumToad>object->string uses write by default rather than display <RhodiumToad>either way, object->string is just a C wrapper that does the call-with-output-string thing <RhodiumToad>(object->string obj display) is the same as (call-with-output-string (cut display obj <>)) in all respects other than being implemented directly in C <libfud>is unless part of one of the scheme standards or is it specific to guile and some other implementations? <RhodiumToad>I don't think it's in r5rs. not sure about later versions, but it's a trivial macro: <apteryx>hello, what's the most idiomatic form to have some code execute no matter what (something called `finally` in other languages' execption handling?) <RhodiumToad>unfortunately continuations make that concept a bit tricky <RhodiumToad>a given block of code might be exited more than once, do you want to run the cleanup each time? <RhodiumToad>dynamic-wind can and will execute the "outgoing" thunk multiple times if need be <apteryx>rekado: that seems like it. I was looking up how call-with-temporary-directory cleans up in (guix utils) and that's what it's using <apteryx>RhodiumToad: hmm, it wouldn't matter in my case even if it's ran multiple times <apteryx>but thanks for the caution about that interesting bit (continuations meaning the same procedure might be exited multiple times) <RhodiumToad>I don't personally approve of arbitrary continuations, but delimited continuations have some interesting uses ***terpri_ is now known as terpri
<afidegnum>i'm new in guile, what utility do i need to implement 2d graphics? i.e diagrams, graphs, interractions between them ? <RhodiumToad>do you want to make a GUI app, or something that renders to output files? <afidegnum>something that renders to output files, i guess, emacs could be a better bridge, I will be ok for a custom GUI too <RhodiumToad>so there's probably a bunch of ways depending on what you want to output and what tools and formats you prefer <afidegnum>ok, in the nutshell, i wanted the built diagrams to output in json, which will be integrated into emacs, still reading on till i discover something handly <stis>Amazing just compiling the python libs reveals bugs there as guile checks and warns for non bounded variables <stis>love this feature of guile and I spen a lot of effort in copying that feature over to python-on-guile <rekado>mwette: turns out it was my fault for misunderstanding the documentation of the library: it says that the vector must be NULL-terminated <rekado>I assumed that it meant that the elements must be \0-terminated strings. <rekado>but they actually mean that the last element must be a pointer with address 0 <rekado>after adding this extra element I cannot reproduce any crashes <rekado>(and thanks again for your patience and help!) <mwette>rekado: good result, then ; that is awesom; glad to see someone thrashing on the ffi-helper