IRC channel logs

2020-08-02.log

back to list of logs

<RhodiumToad> https://dpaste.org/Yosa
<RhodiumToad>main bug is that it won't free the string if pointer->string errors
<daviid>str1ngs: this, imo, is a bug in webkitgtk and/or its GI typelib def - I exposed in depth why i think it is and how to solve it, on #introspectin ... i'm still thinking on the best way to 'workaround', will ping you asap
*RhodiumToad wonders if there's a better way to handle functions returning malloc'd strings in the ffi
<RhodiumToad>w00t. so tests pass with GUILE_JIT_THRESHOLD=1 on freebsd/armv7
<RhodiumToad>still needs one small patch for correct off_t handling
<RhodiumToad>(gen-scmconfig doesn't seem to contemplate the possibility that off_t might be bigger than a long)
<str1ngs>daviid: okay, thanks for the update.
***retropikzel_ is now known as retropikzel
<chrislck>anyone familiar with srfis on https://github.com/scheme-requests-for-implementation/srfi-180/ ??? how to load it in guile???
<leoprikler>you'd probably need to write a wrapper around it
<chrislck>any example somewhere?
<leoprikler>SSAX in the base library, but it should be a bit simpler
<leoprikler>but basically, you need to do a (define-module ...) followed by (include ...)
<chrislck>still difficult. no easy examples found :(
***apteryx is now known as Guest39705
***apteryx_ is now known as apteryx
<a_v_p>Guile-Udev update: I made a better version of procedure that creates an udev monitor instance: https://github.com/artyom-poptsov/guile-udev/blob/dd0c859e3985173b722b5003d1f33fdbd5b9b329/examples/device-listener.scm#L16
***jonsger1 is now known as jonsger
***jonsger1 is now known as jonsger
***jonsger1 is now known as jonsger
<chrislck>what's the safest way of running code *only* when guile-2.2 or guile-2.0 is being called? https://paste.debian.net/1158670/ doesn't seem to cut it
<mwette>I think you need something like (cond-expand (guile-3 (quit)) (guile-2 #t) (else (quit)) ;; the else may be optional)
<mwette>sorry I though entire module, then (cond-expand (guile-2 <code>) (else #t))
<leoprikler>I think the define might be malformed
<mwette>any why the eval-when? I don't think that's needed.
<mwette>s/any/And/
<mwette>Maybe this, then: (cond-expand (guile-3) (guile-2 <code>) (else))
<chrislck>thanks both, will try :)
<pkill9>why does this return '("test2 "test3")? (assoc-ref '(("test" "test2" "test3")) "test")
<ArneBab>RhodiumToad: nice!
<pkill9>actually, why does this return '(("test" "test2" "test3"))?: (pretty-print '(("test" . ("test2" "test3"))))
<str1ngs>pkill9: assoc-ref takes an alist. like (assoc-ref '(("test" . "foo")) "test")
<str1ngs>pkill9: basically it takes a list of pairs
<pkill9>i get that, but why does it turn multiple values into a list?
<pkill9>if there is more than two values
<pkill9>instead of erroring or something
<ArneBab>pkill9: try it without pretty-print
<ArneBab>pkill9: remember that (a . b) is just a shorthand for (cons a b)
<pkill9>oh ok
*ArneBab also stumbled over this a few times :-)
<pkill9>why has that period been made shorthand for cons?
<ArneBab>AFAIK because you can then write cons-cels as data
<ArneBab>try '("test" "test2" . "test3")
<ArneBab>(a . b) with a and b as primitive values is a pair, but not a list.
<ArneBab>'(a b) is a proper list.
<ArneBab>(cons a <some-list>) gives a list
<ArneBab>(cons a <primitive-value>) gives a pair
<ArneBab>AFAIK pairs consume slightly less space because they save one pointer
<dsmith>pkill9: I don't know for sure, but I suspect using . for cons'es has been around about as long as there has been lisp.
<mwette>(list "test" "test2" "test3") = (cons "test" . (list "test2" "test3"))
<mwette>oops remove '.'
<mwette>(list "test" "test2" "test3") = (cons "test" (list "test2" "test3"))
<leoprikler>(list "test" "test2" "test3") = (cons "test" (list "test2" "test3")) = ("test" . ("test2" "test3") )
<manumanumanu>Ahoy hoy!
***jonsger1 is now known as jonsger
<RhodiumToad>I think the only thing that really irritates me about scheme (vs lisp) is having to use () rather than nil
<RhodiumToad>especially in the form (lambda nil ...)
***daviid is now known as Guest52359
***Guest52359 is now known as daviid
<str1ngs>hello I'm trying to write this define-macro as a define-syntax but it's just not groking for me. (define-macro (call-javascript js)
<str1ngs> `(run-javascript (buffer-widget buffer) ,js #f #f #f))
<str1ngs>I'm assuming this can be done with define-syntax since define-macro is not recommended anymore?
<str1ngs>(define-macro (call-javascript js) `(run-javascript (buffer-widget buffer) ,js #f #f #f))
<str1ngs>my example got truncated sorry
<RhodiumToad>where are buffer-widget and buffer going to come from?
<str1ngs>I want (call-javascript "alert();")) to expand to (run-javascript (buffer-widget buffer) "alert();" #f #f #f)) I'm just trying to avoid alot of repeated code.
<str1ngs>I guess I want to template here? is that the right term?
<RhodiumToad>right but the question is, is it ok for buffer-widget and buffer to be resolved in the lexical context of the define-syntax, rather than that of the expansion?
<str1ngs>I'd like to evaluate where the macro is called doe that makes. my macros skill are weak. this is actually an exercise to better understand on my part.
<str1ngs>s/makes/make senses/
<RhodiumToad>so the core distinction between lisp-style defmacros and scheme define-syntax is how the lexical bindings work
<RhodiumToad>the intention is that in scheme, all free variables resolve in their lexical contexts
<RhodiumToad>so basically you've picked a non-trivial example to use as an exercise
<RhodiumToad>if I'm understanding it right, which is by no means certain, you can do it like this:
<RhodiumToad> https://dpaste.org/jQo1
<RhodiumToad>the use of datum->syntax is to construct new syntax in the lexical scope of the caller
<RhodiumToad>str1ngs: ^^ that help?