On Mon, Mar 16, 2020 at 3:54 AM Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:
In that case

(bar :foo x)

and
(bar ':foo x)

would be equivalent.  The would forbid any extension of SRFI 177 to allow procedures taking keyword arguments and a variable number of arguments at the same time as the code of `bar' wouldn't be able to distinguish a keyword introducing an keyword argument from a regular argument, which happens to evaluate to a keyword.


If we take semantics similar to Common Lisp, you don't need to distinguish them.  Actually you don't *want* to distinguish them.
 
 

It doesn't conflict with R7RS-small.  The drawback is that it can't be implemented portably.


On Mon, Mar 16, 2020 at 3:09 AM Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:
Some Schemes have native keywords objects and a lexical syntax for keywords.  Commonly used lexical syntaxes are `:foo', `foo:' and `#:foo'.

In some systems, keywords are self-evaluating like numbers or strings.  In other words, `:foo' or `foo:' are expressions evaluating to the keyword with name `foo'. 

In other systems, keywords are not self-evaluating.  For example, `#:key' is not a valid expression, but `(quote #:key)' is, evaluating to the keyword with name `foo'.

I want to argue that the second alternative is the much better one because it leads to a simpler and more uniform semantics.

In an ordinary procedure call, the procedure and the arguments are evaluated and then the (evaluation of the) procedure is called with the (values of the) arguments.

If the keyword lexical syntax `:foo' is self-evaluating, the base case of the procedure call `(bar :foo x)' is therefore to evaluate `bar' , `:foo' and `x' and to do the call with the corresponding values.

As soon as procedures with keyword arguments are introduced, the R7RS-small rule of how `(bar :foo x)' is to be evaluated has to be changed.  In a strict sense, the resulting language is no more compatible with R7RS-small.

In the other case when `#:foo' is not self-evaluating, there is no clash with the semantics of R7RS-small.  In that case, `(bar #:foo x)' is new syntax (not existing in R7RS-small) and section 4.1.3 of R7RS-small has just to be extended without overriding previous behavior.

The conclusion is: If R7RS-large eventually gets lexical syntax for keywords, it should follow the `#:foo' and not the `:foo' model. SRFI-177 should be specified in a way that makes a smooth transition to the `#:foo' model possible.

Marc


--
Prof. Dr. Marc Nieper-Wißkirchen
 
Universität Augsburg
Institut für Mathematik
Universitätsstraße 14
86159 Augsburg
 
Tel: 0821/598-2146
Fax: 0821/598-2090
 
E-Mail: xxxxxx@math.uni-augsburg.de
Web: www.math.uni-augsburg.de/alg/mitarbeiter/mnieper/