Re: Keyword arguments in procedures specified in SRFIs Peter Bex 22 Jul 2019 18:52 UTC
On Mon, Jul 22, 2019 at 06:54:23AM -1000, Shiro Kawai wrote:
> On the disjoiintness of keywords and symbols, and compatibility...
>
> Gauche used to have keywords disjoint from symbols, noted :foo.  It's not
> conforming rnrs, though

Hi Shiro!

Could you elaborate on it not being rnrs conforming, please?  We just made
the reverse transition in CHICKEN 5.1.

> If you don't want to import (gauche keyword), you can still call
> keyword-accepting procedure by quoting keywords:
>   (foo ':foo 1 ':bar 2)

In CHICKEN, we allow the #:foo syntax always, and WRITE will output
keywords like that to ensure it can be read by any CHICKEN.  There is
a command line flag and SRFI-39 runtime parameter which affects how
keywords are read: "foo:" or ":foo" can be read as keywords or symbols
depending on the setting (which can be set to prefix, suffix or off).

But #:foo will always be read as a keyword regardless of this setting
to ensure at least a level of read-write invariance.

Keywords are always self-evaluating, so 'foo: and foo: are the same
if you have keyword style set to "suffix".  Keywords cannot be bound.
If you want to bind an identifier called "foo:", you can pipe-quote it,
so |foo:| is read as a symbol, while |foo|: is read as a keyword.

Cheers,
Peter