Re: New draft (#6) and last call for comments on SRFI 266: The expr syntax
jobol 06 Sep 2026 21:11 UTC
Le Fri, 4 Sep 2026 18:02:03 -0400,
Peter McGoron <xxxxxx@mcgoron.com> a écrit :
> Given that something like
>
> f(x, y, z - w)
>
> would read as
>
> f(x (unquote y) (unquote z) - w)
>
> Would it be possible to take (unquote <expression>) in the list as
> the argument separator, and continue parsing as-if <expression> was
> spliced into the list?
>
> This is *very* hacky. However, it would allow one to write CALLs into
> ARGUMENTs without parentheses (currently forbidden by the grammar).
I was already thinking such a solution since on of your previous mail.
A bit hacky but feasible.
>
> The other ways to fix it:
>
> 1. Change FORMULA in the production of ARGUMENTS to VALUE. This makes
> `f (a - b)` a syntax error, in favor of `f((a - b))` being the
> correct expression.
> 2. specify that ARGUMENTS disambiguates by parsing the longest
> FORMULA on the left, recursively. This makes `f(a - b)` parse with a
> single argument, and you would have to do `f(a (- b))` to make it two
> arguments. Another example, `f(a - b sin theta)` is two arguments `(f
> (- a b) (sin theta))`, because `a - b` is the longest parse one can
> do (no calls).
The second is just better specifying what is already implemented and (I
believed) specified.
But following the good reviews about the proposal, I'm now inclined to
refactor calls in the following ways:
- enforcing a list of arguments, list possibly empty
- using comma to separate arguments, it will greatly improve the
readability (but see [*])
I'm also thinking on how to implement matching of operators per binding
identity instead of per symbol identity.
It could be easy to achieve it based on the current implementation. I
just need a function that takes 2 arguments: (1) a syntax object and
(2) a location, and that returns true if the syntax object is an
identifier bound to the location in the context of the syntactic
expansion.
Does such a function exist? If yes, what is its name. If no, why?
Regards
José