Re: New draft (#6) and last call for comments on SRFI 266: The expr syntax
jobol 13 Sep 2026 20:59 UTC
Thank you Peter, it unblocks me.
regards
Le Sun, 13 Sep 2026 10:03:34 -0400,
Peter McGoron <xxxxxx@mcgoron.com> a écrit :
> > To be honest, I have expected that some of the fellow schemers had
> >
> shared some minds on that topic. That would help.
>
> I don't understand the issue here.
>
> > But I can not use table programming because in order to use
> free-identifier=? I have to forge an identifier for the symbols. Let
> take the example of "+". '+ is the symbol "+", what I currently use
> for symbol matching. + is the location bound to the symbol '+ in the
> current context of evaluation. And that is all what I can get.
>
> On import, you can store #'+ (the identifier that is bound to the add
> function) in a variable somewhere, and match against that.
>
> Here is my quick-and-dirty port to hygienic matching that works in
> Chez:
>
> https://github.com/mcgoron-peter/srfi-266/blob/master/srfi/expr-hygienic.sls
>
> Example:
>
> (load "expr-hygienic.sls")
> (import (srfi :266))
> (let ((- 10)) (expr 10 + -)) ; => 20
>
> The opdef table is evaluated when the library is loaded, and stores
> the identifier values of +, *, etc.
>
> There are some minor changes (no unbox because that is not in R6RS)
> and I also didn't port the macros that allow you to add operations.
> If you really want to keep them while also being portable-ish to
> R6RS, then the mutation code should run inside of a macro, and not
> the output of one. For example:
>
> (define-syntax add-operator
> (lambda (x)
> (syntax-case x ()
> ((_ identifier priority action replacement)
> (set! ...)))))
>
> This would still be fragile: `expr` used inside of a syntax-case
> macro might not see the new operator in cases where an interpreter is
> not used, for example when using an ahead-of-time compiler.
>
> I still think that extensibility should be made optional or removed
> and addressed in a later SRFI.
>
> > Anyway, it is clear now that only identifier property is the
> > cleaner
> way to implement expr. What are implementations that provide it?
>
> I only know of Chez and Capy[1]. Racket probably has something
> equivalent in power. Some implementations, such as Guile, allow you
> to emulate adding bindings to identifiers by adding reflection to the
> module system (see SRFI 262 source code).
>
> [1]: https://codeberg.org/playXE/capy
>
> -- Peter McGoron
>