> Clojure does not allow for programmer-defined > reader macros (unlike other lisps).
I know this has been touched upon last Spring - and Stu Halloway refs at least one discussion of this in his book. >From a practical standpoint I am beginning to understand more why the choice was made to not support reader macros. But can someone (RH?) clarify the following? Is it possible to introduce reader macros (albeit unsupported frowned upon ones). > You could define a different reader and completely different text-based > syntax for the language. Given the suggestion that Clojure could potentially be reimplemented with a different text-based syntax utilizing an alternate reader does this imply that reader macros are possible under a modified REPL?. >From a purely speculative standpoint, if this is possible - the assertion that "Clojure does not allow for..." may be misplaced. I'm wondering to the extent that it *may* be possible to 'Rig the REPL' where would/does the Clojure license stand on this? I ask, because I remember reading in one of P. Graham's books '.* LISP' that some commercial LISPs were/are distributed with exceptions for calling `eval' at the top level - presumably to prevent one from modifying the REPL with some combination of macros/reader macros. Has Clojure taken an alternate approach whereby code distributed under license simply doesn't permit user defined reader macros? And if so - would it not be more appropriate to communicate (as a matter of policy - and stakeholder prudence) - "The Clojure License agreement doesn't *permit* user introduction of reader macros which when expanded at compile time attempt to modify the designer(s) intended specification of Clojure's REPL"? I tend to recoil at the use of the phrase, "not allowed", and while I'm not personally even remotely capable of even beginning an attempt to endeavor to introduce any sort of modification as envisioned above I can certainly imagine situations/environments where such an attempt might be made - advocate(s) of competitive open source license models being one of the more benign examples... If I have mis-characterized something or have otherwise misunderstood the situation/possibilities I apologize. s_P On Dec 11, 5:03 pm, Daniel Eklund <doekl...@gmail.com> wrote: > > I've been reading the latest chapter from Stuart's book, Chapter 7: > > Macros, and he makes this statement: > > > "Clojure has no special syntax for code. Code is simply Clojure data. > > This is true for normal functions, but also for special forms and > > macros. Consider a language with syntax, such as Java. ..." > > > It seems to me that just like all lisps, Clojure has syntax. The > > first and most obvious piece of syntax is the parenthesises. Lists > > start with an open paren and end with a closing paren. This is syntax > > and you can't change it with a macro. > > I would agree with you, but I do not feel too strongly about the > matter. The statement "clojure has _no_ syntax" is probably not > defensible with an eye towards formal rigor.. I have no idea what a > syntax-less language would look like. I feel fairly certain that the > book's aims are not to provide a hard stance on no-syntax but to open > the eyes of those people who have been dealing with the Java's and the > C's for their entire careers, where syntax is locked in by convention > and grammar specs. > > Despite quote and {} and [] being syntax-tic sugar, they certainly > have their sexp counterparts, and all of this is driven from the > reader which could possibly be extended or reduced for particular > needs -- although Clojure does not allow for programmer-defined > reader macros (unlike other lisps). > > The existence of the reader makes the "no syntax" claim a lot easier > to understand, but in the end, this could be a long discussion about > what each person feels "syntax" is. > > my $0.02 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---