Re: Keywords reduced Marc Nieper-Wißkirchen 20 Oct 2019 21:33 UTC

Am So., 20. Okt. 2019 um 23:19 Uhr schrieb Shiro Kawai <xxxxxx@gmail.com>:
>
> On Sun, Oct 20, 2019 at 11:10 AM Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:
>>
>>
>> Obviously, when we want hygienic identifiers as keywords, argument
>> lists cannot be constructed using quasiquote alone.
>>
>> So far, we have only debated about the semantics, not about the
>> syntax. But one conceivable syntax could be that a keyword like
>> `test:' can be used as keyword in a special form so that your example
>> becomes:
>>
>> (define z-args `(arg1 arg2 ,(test: eqv?)))
>>
>
> This is interesting.  So test: can be resolved to identifier, but then what (test: eqv?) evaluates to?
> Will it be evaluated to something like (<identifier of test:> <procedure eqv?>)?
>
> It brings identifier into runtime.  How the procedure z compares the identifiers at runtime?
>

I haven't yet thought a lot about how to implement it — maybe we
should actually write the code for a few proposals and see what's
possible and what's not.

I definitely don't want to bring the identifier into the run-time, but
I don't think that it is needed. Whenever a hygienic keyword is
created (that is where `test:' is bound), an internal counter value
could be recorded with the binding.

(test: eqv?)

would then become something like `(12345678 #<procedure eqv?>)' where
`12345678' is a unique number or unique location in the store (think
of the generative records of R7RS). Keyword argument lists could then
also be modeled through hash tables instead of alists.

We already have such a mapping from identifiers to run-time objects in
the R7RS, namely parameter objects, which can serve a similar purpose
than keyword objects, namely extending procedures with optional
arguments without changing the API.

(Thinking of parameter objects... what can keyword arguments do what
parameter objects and parameterize cannot already do?)