Email list hosting service & mailing list manager

Reawakening keywords John Cowan (23 Apr 2020 21:16 UTC)
Re: Reawakening keywords Alex Shinn (23 Apr 2020 22:51 UTC)
Re: Reawakening keywords John Cowan (23 Apr 2020 23:35 UTC)
Re: Reawakening keywords Alex Shinn (24 Apr 2020 00:04 UTC)
Re: Reawakening keywords John Cowan (24 Apr 2020 00:45 UTC)
Re: Reawakening keywords Marc Nieper-Wißkirchen (24 Apr 2020 06:15 UTC)
Re: Reawakening keywords Lassi Kortela (24 Apr 2020 06:44 UTC)
Re: Reawakening keywords Marc Nieper-Wißkirchen (24 Apr 2020 06:46 UTC)
Re: Reawakening keywords Lassi Kortela (24 Apr 2020 06:52 UTC)
Re: Reawakening keywords Marc Nieper-Wißkirchen (24 Apr 2020 07:10 UTC)
Re: Reawakening keywords Lassi Kortela (24 Apr 2020 07:27 UTC)
Re: Reawakening keywords Marc Nieper-Wißkirchen (24 Apr 2020 07:43 UTC)
Re: Reawakening keywords Lassi Kortela (24 Apr 2020 08:00 UTC)
Re: Reawakening keywords Marc Nieper-Wißkirchen (24 Apr 2020 08:26 UTC)
Re: Reawakening keywords Lassi Kortela (24 Apr 2020 08:34 UTC)
Re: Reawakening keywords Amirouche Boubekki (24 Apr 2020 06:54 UTC)
Re: Reawakening keywords Lassi Kortela (24 Apr 2020 07:04 UTC)
Re: Reawakening keywords Marc Nieper-Wißkirchen (24 Apr 2020 07:13 UTC)
Re: Reawakening keywords Lassi Kortela (24 Apr 2020 07:36 UTC)
Re: Reawakening keywords Lassi Kortela (24 Apr 2020 06:39 UTC)
Re: Reawakening keywords Arthur A. Gleckler (24 Apr 2020 15:07 UTC)
Re: Reawakening keywords John Cowan (25 Apr 2020 00:07 UTC)
Re: Reawakening keywords Arthur A. Gleckler (25 Apr 2020 00:12 UTC)
Re: Reawakening keywords Marc Nieper-Wißkirchen (25 Apr 2020 07:51 UTC)
Re: Reawakening keywords John Cowan (25 Apr 2020 16:04 UTC)
Re: Reawakening keywords Marc Nieper-Wißkirchen (25 Apr 2020 16:40 UTC)
Re: Reawakening keywords John Cowan (25 Apr 2020 18:10 UTC)
Re: Reawakening keywords Marc Nieper-Wißkirchen (25 Apr 2020 18:25 UTC)
Re: Reawakening keywords John Cowan (25 Apr 2020 22:02 UTC)
Re: Reawakening keywords Marc Nieper-Wißkirchen (02 May 2020 19:33 UTC)
Re: Reawakening keywords Marc Nieper-Wißkirchen (24 Apr 2020 06:10 UTC)

Re: Reawakening keywords Marc Nieper-Wißkirchen 24 Apr 2020 06:10 UTC

Am Fr., 24. Apr. 2020 um 01:36 Uhr schrieb John Cowan <xxxxxx@ccil.org>:

[...]

> The idea is to correctly take apart (lambda/kw (foo ... &kw baz ...) ...) and reassemble it, where &kw is a syntax keyword.

In any case, this syntax has to be amended if we do not want to have
the keyword `baz' bound to the lexical identifier with the name `baz'.
Apart from that symbols shouldn't be muddled with identifiers, the
body of `lambda/kw' may want to easily access a `baz' defined outside.

> The Chibi approach is absolutely workable and portable, but does not allow interoperability with native keyword arguments in those Schemes that have them.  What is more, if the compiler understands and can efficiently compile keywords, as Racket can, using Chibi-style keywords instead is a performance hit.  So we need a macro wrapper for each call with keywords (you don't need the wrapper if you are omitting all of them) to generate the correct procedure call.

Unless we are turning procedures taking keyword arguments into macros,
for all keyword approaches we have discussed so far help from the
compiler is needed to efficiently compile the call. Such a compiler
can equally well optimize a procedure call with keyword arguments in
the form `(foo 1 2 'bar 3 'baz 4)', where the symbols `bar' and `baz'
introduce optional arguments.

In terms of language complexity, this looks more convincing to me than
introducing keyword objects just to be able to write `(foo 1 2 :bar 3
:baz 4)'.

If one really wants this, one could add to the expander a new binding
form `(define-name <id> <symbol>)', which binds `<id>' to a unique (!)
entity, which evaluates to `<symbol>'. A library `(foo)' that uses the
arguments keywords `bert' and `ernie' would contain `(define-name
:bert bert)' and `(define-name :ernie ernie)' and export `:bert' and
`:ernie'. A user could then write `(foo 1 2 :bert 3 :ernie 4)'.

The library `(quux)' may make use of `bert' and `kermit', so it will
export `:bert' and `:kermit' using the same machinery. The binding of
`:bert' will, however, not clash with the binding of `:bert' in
`(foo)' because the bindings are exactly the same by the special
property of the `define-name' binding form.