Re: Keyword arguments in procedures specified in SRFIs
Per Bothner 23 Jul 2019 05:57 UTC
On 7/22/19 10:39 PM, Peter Bex wrote:
> On Mon, Jul 22, 2019 at 11:22:33PM +0300, Lassi Kortela wrote:
>> Kawa:
>>
>> (symbol->string '#:foo) => "foo:"
>
> That's odd.
>
> In CHICKEN, (keyword->string #:foo) => "foo", because the colon
> is part of the indication to the reader that it's a keyword, it's
> not actually part of the keyword's name itself.
You seem to be confounding symbol->string and keyword->string.
In Kawa, too:
(keyword->string '#:foo) => "foo"
Kawa has packages/namespaces (https://www.gnu.org/software/kawa/Namespaces.html).
Plain Scheme symbols are in the "empty namespace" while keywords are in the "keyword namespace".
That leads to the question is how symbol->string should handle symbols in non-empty namespaces.
The current implementation calls the Java toString method, which defaults to "LOCALNAME:" for a keyword;
"LOCALNAME" if in the empty namespace; "PREFIX:LOCALNAME" if PREFIX is specified;
and "{URI}LOCALNAME" otherwise. Perhaps not the best choice, but it is compatible with RnRS,
and useful.
--
--Per Bothner
xxxxxx@bothner.com http://per.bothner.com/