IRC channel logs

2025-07-02.log

back to list of logs

<ttz>Thanks wingo for your answer! My concrete case is actually a bit more complex as the vector would be returned by a function. Would the compiler be clever enough not to allocate the vector in that case?
<sneek>Welcome back ttz, you have 1 message!
<sneek>ttz, wingo says: there is no such shorthand, but (match (vector 1 2) ...) usually avoids allocating the vector
<ttz>I was trying to find the best way to return one or more values from a function and to act on it in another.
<omentic>i've got a syntax object of a list i'd like to treat as a list of syntax objects. is there a nice way to do this while preserving syntax properties?
<omentic>racket has syntax->list but perusing the manual i only see syntax->datum...
<wingo>sneek: later tell ttz what about call-with-values / values makes it the wrong thing for you?
<sneek>Got it.
<wingo>omentic: it is a bit gross but in guile (syntax-case x () ((elt ...) #'(elt ...))) should work i think
<wingo>not sure tho
<wingo>the better answer i think is to use syntax-expression from (system syntax internal)
<wingo>but it is undocumented
<ttz>wingo: won't call-by-values with a variable number of arguments allocate on the caller side?
<sneek>Welcome back ttz, you have 1 message!
<sneek>ttz, wingo says: what about call-with-values / values makes it the wrong thing for you?
<ttz>*call-with-values
<ttz>(call-with-values f (λ args (match args ((x) ...) ((w x y z) ...))))
<ttz>Is there allocation for args?
<wingo>if the args are a rest arg, yes usually that allocates
<wingo>you can use case-lambda if there are only a couple return arities
<wingo>current status: precise tracing is working with heap-conservative-mmc. added a mode to whippet to disable defragmentation / compaction / evacuation if ever a conservatively-traced object is allocated; this is the smob migration story
<wingo>working on getting the moving collector working; perhaps today
<ArneBab>wingo: nice! Thank you!
<omentic>wingo: thx for the pointer! i'll look at that
<omentic>this syntax-case works nicely for this one, but i have some more involved stuff i wanna do, so will check out syntax-expression
<wingo>good evening
<dthompson>hey wingo
<daviid>whereiseveryone: try "guile -q", then in the repl, *features*
<wingo>well, compacting works enough to compile some things. still a bug or two