That was one of the best explanations of code as data I've ever read.
Kudos!

On Thu, Dec 11, 2008 at 4:44 PM, Randall R Schulz <rsch...@sonic.net> wrote:

>
> On Thursday 11 December 2008 13:37, Paul Barry 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.
>
> Punctuation is not syntax. Lisp can be said to have a syntax, that of
> the S-Expression. Beyond that, as someone else pointed out in another
> thread here recently, when we write Lisp code, we're basically writing
> directly the AST that other languages would need a parser implementing
> a complicated grammar to produce.
>
>
> > Next is the single quote, which is just an alias for quote.
> > Somewhere along the line, someone decided that (quote foo) was too
> > verbose and they wanted 'foo to be syntactic sugar for (quote foo).
> > That wasn't and can't be done as a macro.  For example, if I wanted
> > to define my own single quote, say $foo, I can't without modifying
> > the parser.
> >
> > Clojure goes on to add a lot of syntax.  The literal syntax for
> > vectors [], maps {}, sets #{}, functions #(), keywords :, etc. are
> > all syntax, not possible with macros, and then there are all the
> > "reader macros" that are listed in Section 2.2, Comment ;, Deref @,
> > Meta ^, Metadata #^, regex #"", syntax-quote `, unquote ~,
> > unquote-splicing ~@, and var-quote #'.
>
> All these things are syntactic sugar. Shorthand ways to write things
> that have vanilla S-Expression counterparts. Again, I would not call
> them syntax.
>
>
> > So is it really valid to claim Clojure has no syntax?
>
> Very nearly so.
>
>
> Randall Schulz
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to