On Monday, 12 August 2013 15:52:53 UTC+8, Răzvan Rotaru wrote: > Hi, > > I'm curious about the general opinion on the Clojure syntax, whether > people actually like it or just use it because it provides macros. So I > would like to ask you to participate in a poll. Thank You. > > The importance of syntax in programming languages is vastly exaggerated.
Syntax alone makes no difference to what you can do with a language in a computational sense. The value mostly comes down to familiarity (which is entirely personal) and practicality (for which different domains may have different trade-offs / requirements). There is therefore no such thing as "perfect" syntax - it depends who you are and what you are doing. That being said, Clojure syntax represents a number of excellent design decisions: 1. It is homoiconic (which makes it much more practical for macros / code generation / DSLs) 2. An expression (function application) is represented as a single form. Arguably this is *the* fundamental building block of code. 3. Forms are consistently delimited with matched parentheses (which makes it very convenient for editing / quick prototyping with code blocks) 4. It is a Lisp (which gives familiarity to Lisp users at least) 5. It is very regular (which makes it convenient for code generation and programmatic code analysis) 6. It uses visually differentiated forms in sensible ways (e.g. [] for argument lists) 7. It is whitespace invariant (which IMHO makes rapid editing easier and avoids subtle bugs) 8. There is no ambiguity about operator precedence / evaluation order 9. It has an excellent range of data literals 10. It tends to be concise (probably more to do with the powerful standard functions than the syntax, but still....) 11. It has a very convenient syntax for host interop A few legitimate criticisms of Clojure syntax: 1. It is unfamiliar to people coming from the most popular paradigms (i.e. C/Java). Fine, but time to learn :-) 2. The lack of infix notation is unfamiliar for anyone used to conventional mathematical notation (i.e. most people). Again, this is just a learning curve. 3. The reader macros are tricky (especially when they interact with metadata, the environment, the compiler, type hints and literal handling in non-obvious ways) 4. Quoting / unquoting can be tricky (I think this is an unavoidable trade-off however if you want the benefits of a homoiconic Lisp) Overall though, I think the advantages significantly outweigh the disadvantages. This is true *even if* you have to go through a learning curve after coming from a non-Lisp background. I'm not aware of any general purpose language designed for power users (i.e. those who appreciate the power of macros and similar features) that can claim an objectively better syntax. To summarise: +1 for Clojure's current syntax :-) -- -- 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 Note that posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.