Re: Keyword arguments in procedures specified in SRFIs
Lassi Kortela 21 Jul 2019 21:48 UTC
> The trouble with #! flags for this purpose is that they are file-global,
> making it hard to mix and match snippets.
You could mix all three alternative notations in the same file by
enabling all of the syntax extensions simultaneously.
There are probably esoteric cases where this would break (a source file
depends on foo: or :foo being a normal symbol, but then the programmer
pastes in some other code that assumes they are keywords). Since coders
would enable this stuff for their own code on a file-by-file basis, it
would be their responsibility to sort out any such weirdness.
Since a #! directive can change syntax mid-file, that could also be
leveraged (it would probably be too clever, but it'd be possible).
> They also don't work well for data (what does `read` assume?)
`read` would use the implementation's default syntax unless #! is used
to enable syntax extensions. That means keywords couldn't be used in
portable data (which is the situation that we already have, so the new
situation would strictly increase expressiveness for code where it matters).
I don't find keywords crucial for data -- since quoting is not needed,
ordinary symbols work fine there. But for code it's somewhat difficult
to do without. I guess quoted symbols could be used instead of keywords
in code as well, for named arguments.
> In short, it's all a big mess.
We can clean it up. If we solve a long-standing mess it will give us a
big morale boost for solving bigger problems.