Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela 22 Jul 2019 23:13 UTC
> And yes, using #:foo syntax can allow having keywords separete from > symbols. Unfortunately though, Gauche uses #:foo syntax for uninterned > symbols, taken from Common Lisp. It's the same as Kawa---it's a symbol, > but reading eq-ness isn't preserved reading #:foo. By the way, what does an uninterned symbol mean in Scheme and does it have the same meaning in Gauche and Gambit? In CL since symbols are placed in packages, it means a symbol that is not in any package. But since Scheme symbols are not namespaced, are there other differences between interned and uninterned symbols than comparing inequal even if they have the same name? Would uninterned symbols have other uses besides gensyms in Scheme? > I chose :foo over #:foo mainly because of the matter of taste; #:foo > stands out too much for me and :foo is about right in balance of > standing-out and blending-in. However, my taste may be influenced too > much from Common Lisp experience. This is true - every now and then, someone says they dislike the #:foo syntax on aesthetic grounds. I also prefer :foo for the same reasons as you. Slowly getting used to #:foo. I guess it's also a cultural indicator about how often people should use keywords. The simple prefix or suffix : paints them as something quite ordinary, and indeed CL programmers casually use keywords all over the place. The more imposing #: says "you're doing something fancy here - perhaps too fancy" so it suggests programmers should think twice before using them. In CL the uninterned #: symbols look noteworthy and it looks like they do something perhaps too fancy - which is the intended effect. Since CL uses package:symbol syntax to refer to symbols in different packages, the :keyword syntax can be thought of as a special case of that notation - the case where the package is blank. (Keywords are actually interned in a package and that package's name is not "", but anyway.) I suppose Scheme is happy with the R6RS/R7RS import/export system so namespaced symbols are not a pressing concern for us. Finally, perhaps the strongest argument for :foo keywords is that the major Lisp dialects except Scheme have that syntax. Common Lisp, Clojure, even Emacs Lisp. Add several Scheme implementations to the list. So from the perspective of the whole Lisp family, Racket and Kawa are some of the only ones that have a different syntax (though they also have different semantics for keyword arguments, it makes sense from that point of view). Still RnRS treating :foo as a symbol suggests caution.