IRC channel logs

2025-07-01.log

back to list of logs

<omentic>is there any way to overload builtin operations with define-syntax?
<omentic>specifically, i'd like to define a (define-syntax (name args ...) ...), to desugar to (define-syntax name (lambda (args ...) ...))
<omentic>guile doesn't seem to like this very much and tells me my source expression fails to match patterns...
<mwette>omentic: check out define-syntax-rule
<omentic>mwette: it's the same issue
<omentic>the full definition i'm trying to write is (define-syntax-rule (define-syntax (name arg* ...) body* ...) (define-syntax name (lambda (arg* ...) body* ...)))
<omentic>but this fails for the identifier define-syntax specifically (because it's a builtin ??)
<omentic>fixed it!! needed to provide a direct mapping for (define-syntax name body ...) as well. guess it was a staging issue?
<omentic>so now my syntax-case has two cases and all is right in the world
<dsmith>yey!
<whereiseveryone>daviid: a prelude is just the base library that is loaded
<ttz>Is it possible to pattern-match several values without allocating memory using the macro from (ice-9 match)?
<ttz>I would like something like (match (values 1 2) (a b ...)) instead of (match (cons a b) ((a . b) ...))
<mwette>you can match several elements of a list or vector, not sure about values
<mwette>elements of a record also
<wingo>sneek: later tell ttz there is no such shorthand, but (match (vector 1 2) ...) usually avoids allocating the vector
<sneek>Got it.
<wingo>so, wip-whippet status: i have a precise trace function and i think i've sprinkled the needed calls to gc_pin_object to all the places that need it. still missing a mode where making an untraceable object will throw the whole thing into non-moving, conservative tracing.
<wingo>but i should be able to test the moving collector now
<mwette>thanks for the update
<adamhume>The key is: we should distinguish between the idea of “using call/cc as an API that reify current control stack as a value to be used later”, and the idea of “using call/cc directly to implement exceptions/parameters/threads”.
<adamhume>For the former, call/cc does a good job (and it's no wonder why Racket implemented their control features on Chez's efficient call/cc implementation)
<adamhume>call/cc screws up on the latter, due to the lack of research on the interaction of these control features by previous scholars.
<adamhume>sorry, I send these message to the wrong channel :(, it should be sent to #scheme
<omentic>is there anything like racket's syntax-parse floating around?
<omentic>i'd like to write a macro that 1) fails unless it has access to a particular syntax parameter and 2) invokes that parameter
<omentic>in racket, i'd write this smth like (define-syntax (foo stx) (syntax-parse stx [(foo) #:fail-unless (syntax-parameter-value #'x) #:attr x (syntax-parameter-value #'x) x])), but i don't know if it's possible to do the equivalent in guile
<omentic>(also -- i'd like to be able to shadow define-syntax to take args directly, like above. i can't seem to overload it though so rn i have a define-syntax^ that does so. is there a way to overload define-syntax directly?)
<ArneBab>wingo: sounds great!
<mwette>di
<wingo>meow
<mwette>wingo: How's it progressing?
<wingo>mwette: i can build --with-gc=stack-conservative-parallel-mmc, which is what i want
<wingo>but it doesn't run ;) there are some asserts failing, related to how i use some bits in the mark word. still pondering what to do about that
<wingo>close tho!
<mwette>Good to hear. Sounds like some hunting to go. Good luck!
<wingo>tx!
<wingo>hopefully tomorrow
<mwette>I'm trying to get my C parser to deal with typename oddities: typedef struct S S; struct S { S* S; } s;
<wingo>neat
<mwette>makes the grammar a bit uglier but long needed upgrade