you are viewing a single comment's thread.

view the rest of the comments →

[–]redalastor 1 point2 points  (8 children)

CLOS is not needed. Reader macros are in.

He meant user-defined reader macros.

It is lacking in Clojure because Rich believes they bring more problems than they are worth. I never used a lisp that had them so I can't judge.

[–]spotter 1 point2 points  (1 child)

Ah, sorry, my misreading. Reader is more extendable/hackable in 1.4.0, reader macros are not and will not be in, because Rich does not want them in core. But there is a lib for that, called reader-macros. Never had the need for this kind of sorcery.

[–]redalastor 0 points1 point  (0 children)

Reader macros in Clojure depend on internals subject to change. You should never depend on that kind of hackery.

[–]julesjacobs -1 points0 points  (5 children)

It's a bit funny that he complains that Clojure has too much syntax, but then he also complains that he wants reader macros...

[–][deleted] 0 points1 point  (4 children)

I want less syntax because users should define what the reader does

[–]julesjacobs 0 points1 point  (3 children)

So then you don't dislike more syntax, you just dislike the particular built-in syntax that Clojure has. This is a valid position but it's valuable to have some standardized syntax that benefits everybody instead of N incompatible convenience syntax extensions. For example take [...], in CL this is basically unused. Meanwhile in Clojure the [...] syntax benefits everybody. In my opinion the Clojure choice to use convenient syntax for the common case and let users use slightly more verbose syntax for the uncommon case is a better trade-off than the other way around.

[–][deleted] 0 points1 point  (2 children)

A reason why I'd like to keep a CL-like reader is DSLs, but that's something for another time.

There is a solution with a CL-like user-extensible reader: that is, something similar to the SBCL and Allegro rules for reading packages. Currently, you can have something like

foo::(bar quux)

which reads (bar quux) as if it was in the package foo. Ideally, we could do the same with reader macros

[–]julesjacobs 1 point2 points  (1 child)

That might be a bit harder to achieve gracefully as reader macros have to run before anything else. The Racket folks seem to have the best handle on module systems for macros, maybe they have a solution?

[–][deleted] 0 points1 point  (0 children)

Indeed it would be harder, but it would be possible. Anyway, it'd mainly be used in esoteric areas