> And I'm surprised how many people claim to love #:keyword.  (The engineering 
> opposition to any non-backward-compatible change was entirely predictable, 
> but I assumed only a small percentage would actually prefer #:keyword, due to 
> familiarity or different aesthetic wiring, and that around half the people 
> would be indifferent to the change.)

I was going to refrain from saying anything more on this subject (I didn’t 
respond to the survey at all), but this point interested me. I realized that 
I’ve grown fond of #:keyword, and I didn’t have any idea why. There have been 
many times that I’ve found it clunky, or that I’ve missed Clojure or Ruby’s 
:keywords.

That’s when I realized: Racket doesn’t use its keywords like those languages 
do. Clojure uses them constantly—it uses them wherever Racket would usually use 
symbols—and Rails has elevated Ruby’s symbols above literal strings in pure 
frequency (for better or for worse).

In Ruby, I can do `x = :kw`. In Clojure, I can do (def x :kw). In Racket, I 
have to do (define x '#:kw), and that is really awful. I need not one but 
three(!) symbols in front of my raw identifier, and the level of syntactic 
noise is pretty atrocious. As a side effect of both this and the traditional 
use of symbols in scheme for this purpose, Racket pretty much only uses 
keywords for one thing: keyword arguments.

In Racket, a bare #:keyword used as an expression is not just useless, it is a 
syntax error. A Racket programmer is trained to see keywords in function 
application alone, so (foo #:kw bar) looks fine, but (foo #:kw) looks weird. 
They always need to be paired with a value. With keywords so integrally 
associated with function application syntax, I’ve grown to think of keywords as 
syntax, never as runtime values, and the hash prefix reinforces this. Heck, 
even syntax/parse’s :expr syntax class rules out keywords! They are little 
syntactic tags, nothing more.

For me, this is actually fine. I don’t really mind the verbosity, though making 
keyword arguments prettier would be nice to have. However, if you are arguing 
for using keywords as runtime values, that’s an entirely different story... 
though it does raise the question of how they should be special-cased in 
function application for keyword arguments (both Ruby and Clojure effectively 
transform keyword arguments into a single hash argument, rather than making 
“keyword procedures” that have some special magic).

Basically: keywords are very different in Racket. I don’t know much CL, so I 
can’t speak to that, but I think there’s more going on here than syntax. If 
that’s the case, omitting a hash would only solve a portion of the problem... 
and Racket programmers might not view their keywords in the same light as those 
from other languages. I certainly didn’t.

Sorry for the rambling... but maybe some food for thought.

Alexis

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to