Email list hosting service & mailing list manager

Self-evaluating keywords or not? Marc Nieper-Wißkirchen (16 Mar 2020 13:09 UTC)
Re: Self-evaluating keywords or not? Shiro Kawai (16 Mar 2020 13:45 UTC)
Re: Self-evaluating keywords or not? Marc Nieper-Wißkirchen (16 Mar 2020 13:54 UTC)
Re: Self-evaluating keywords or not? Shiro Kawai (16 Mar 2020 13:58 UTC)
Re: Self-evaluating keywords or not? Marc Feeley (16 Mar 2020 15:38 UTC)
Re: Self-evaluating keywords or not? Marc Nieper-Wißkirchen (16 Mar 2020 16:00 UTC)
Re: Self-evaluating keywords or not? Per Bothner (16 Mar 2020 16:47 UTC)
Re: Self-evaluating keywords or not? Marc Nieper-Wißkirchen (16 Mar 2020 16:53 UTC)
Re: Self-evaluating keywords or not? Shiro Kawai (16 Mar 2020 20:27 UTC)
Re: Self-evaluating keywords or not? Marc Nieper-Wißkirchen (16 Mar 2020 20:37 UTC)
Re: Self-evaluating keywords or not? Lassi Kortela (16 Mar 2020 21:17 UTC)
Re: Self-evaluating keywords or not? Marc Nieper-Wißkirchen (16 Mar 2020 21:31 UTC)
Re: Self-evaluating keywords or not? Shiro Kawai (16 Mar 2020 22:05 UTC)
Re: Self-evaluating keywords or not? Marc Nieper-Wißkirchen (17 Mar 2020 07:14 UTC)
Re: Self-evaluating keywords or not? Shiro Kawai (17 Mar 2020 07:46 UTC)
Re: Self-evaluating keywords or not? Marc Nieper-Wißkirchen (17 Mar 2020 08:05 UTC)
Re: Self-evaluating keywords or not? Shiro Kawai (17 Mar 2020 08:31 UTC)
Re: Self-evaluating keywords or not? Lassi Kortela (16 Mar 2020 22:18 UTC)
Re: Self-evaluating keywords or not? Per Bothner (16 Mar 2020 22:36 UTC)
Re: Self-evaluating keywords or not? Shiro Kawai (16 Mar 2020 22:42 UTC)
Re: Self-evaluating keywords or not? Marc Nieper-Wißkirchen (17 Mar 2020 07:22 UTC)
Re: Self-evaluating keywords or not? Shiro Kawai (16 Mar 2020 21:34 UTC)
Re: Self-evaluating keywords or not? Shiro Kawai (16 Mar 2020 21:43 UTC)
Re: Self-evaluating keywords or not? Lassi Kortela (16 Mar 2020 22:02 UTC)
Re: Self-evaluating keywords or not? Shiro Kawai (16 Mar 2020 22:06 UTC)
Re: Self-evaluating keywords or not? Shiro Kawai (16 Mar 2020 22:19 UTC)
Re: Self-evaluating keywords or not? Lassi Kortela (16 Mar 2020 22:24 UTC)
Re: Self-evaluating keywords or not? Marc Nieper-Wißkirchen (17 Mar 2020 07:28 UTC)
Re: Self-evaluating keywords or not? Per Bothner (16 Mar 2020 22:24 UTC)
Re: Self-evaluating keywords or not? Lassi Kortela (16 Mar 2020 22:56 UTC)
Re: Self-evaluating keywords or not? Per Bothner (17 Mar 2020 00:36 UTC)

Re: Self-evaluating keywords or not? Per Bothner 16 Mar 2020 16:46 UTC

> Am Mo., 16. März 2020 um 16:38 Uhr schrieb Marc Feeley <xxxxxx@iro.umontreal.ca <mailto:xxxxxx@iro.umontreal.ca>>:
>
>     The point of the foo: (or :foo) syntax for keywords and the self-evaluation is to provide a lightweight and “visually” agreable syntax for calling a procedure with keyword arguments.  In this respect I find the following visually disagreable:
>
>         (bar 42 'foo: 88 'baz: 99)
>         (bar 42 '#:foo 88 '#:baz 99)
>
>     Self-evaluating keywords make the code more lightweight:
>
>         (bar 42 foo: 88 baz: 99)
>         (bar 42 #:foo 88 #:baz 99)

>On 3/16/20 8:59 AM, Marc Nieper-Wißkirchen wrote:
> My original post in this thread was not about the exact form of the lexical syntax, be it `foo:', `:foo', or `#:foo'.  (The latter, which you find visually less pleasant, has the advantage of not clashing with R7RS-small.)

To put it more concretely: Kawa does not have self-evaluating keywords,
but it does use the syntax:
    (bar 42 foo: 88 baz: 99)

The keyword foo: is part of the application syntax. It is not an expression that is evaluated.

Advantages: Avoid semantic ambiguity.  Potentially robust compile-time keyword matching and checking.
For example, the implementation (compiler or run-time) can reject as an error:
   (cons a: 12)

Also, potentially faster and more compact keyword-passing: Kawa sorts the keywords at both the function
definition and the call sites.  (This is easier and more robust when you can syntactically
distinguish keywords. ) That means means keyword matching is O(0) without the overhead
(space and time) of using hash tables; instead you can use compact cache-friendly vectors.

Disadvantage: A bit more complicated than plain self-evaluating keywords.  You need to
decide how to generalize apply, how to deal with "other" keywords (those not explicitly
listed in the procedure definition), and how to handle "argument list" (#!rest) objects.

This is Kawa's solution:
https://www.gnu.org/software/kawa/Application-and-Arguments-Lists.html
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/