Email list hosting service & mailing list manager

lambda/kw syntax and mixing identifiers and symbols Marc Nieper-Wißkirchen (03 Mar 2020 08:58 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols Lassi Kortela (03 Mar 2020 11:22 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols Marc Nieper-Wißkirchen (03 Mar 2020 11:45 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols Lassi Kortela (03 Mar 2020 12:26 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols Marc Nieper-Wißkirchen (03 Mar 2020 12:57 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols Lassi Kortela (03 Mar 2020 14:26 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols Marc Nieper-Wißkirchen (03 Mar 2020 14:52 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols Lassi Kortela (03 Mar 2020 16:48 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols Marc Nieper-Wißkirchen (06 Mar 2020 07:33 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols John Cowan (06 Mar 2020 13:52 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols Marc Nieper-Wißkirchen (06 Mar 2020 14:55 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols John Cowan (06 Mar 2020 15:45 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols Marc Nieper-Wißkirchen (06 Mar 2020 16:12 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols Marc Nieper-Wißkirchen (07 Mar 2020 14:18 UTC)
Re: lambda/kw syntax and mixing identifiers and symbols Marc Nieper-Wißkirchen (09 Mar 2020 08:04 UTC)

Re: lambda/kw syntax and mixing identifiers and symbols Lassi Kortela 03 Mar 2020 11:22 UTC

> The lambda/kw (keyword-lambda in the old draft) macro, however,
> interprets the keywords both as symbols and as identifiers. They are
> interpreted as symbols when the keyword list passed by call/kw is
> examined, but they are interpreted as identifiers when they are bound
> through let in the body of the procedure taking keyword arguments.
>
> Without macro expansions, symbols and identifiers can be used
> interchangeably. With, however, there is a difference. Symbols are
> compared by `eq?', identifiers in let binding forms are compared by
> `bound-identifier=?'. In general, both equivalence predicates are not
> comparable.
>
> Thus, in the most general contexts where lambda/kw can be used, there
> can be a problem. There will also at least be an inconvenience if a
> keyword argument is named in a way that would shadow an identifier used
> in the body of the procedure.
>
> The simple solution is to slightly extend the system so that, for example,
>
> (lambda/kw (a b (c d (f e))))
>
> would mean to bind the identifier c to the keyword argument named c, the
> identifier d to the keyword argument named d, and the identifier f to
> the keyword argument e.

Excellent observation. This didn't occur to me. Your in-depth knowledge
of macro systems is really useful to the community :)

If the distinction between symbols and identifiers is important, it
shouldn't be a problem to add a syntax like the one you propose. Since
it's an optional feature that is not used most of the time, it doesn't
cause any disruption.

I'd probably like to omit it from 177 on grounds of simplicity, but from
my limited understanding it sounds like it makes sense to have it in a
full-blown language spec like R7RS-large. If we can find a simple way to
add it to 177 as well, it's still possible too.

177 has to be implementable using non-hygienic define-macro as well, but
this issue shouldn't prevent that.