On Sun, Sep 18, 2011 at 4:40 AM, Meikel Brandmeyer <m...@kotka.de> wrote: > Hi, > > Am 18.09.2011 um 10:11 schrieb Ken Wesson: > >> Tell me which is simpler: >> >> Reader.read("{:foo 1 :bar " + x + "}"); > > String x = "13rabc"; > > Have fun.
Syntactically invalid Clojure code would fail just as much in Clojure source as it would in Java source. If x is expected to be a string, it needs to be quoted. If it's not, then you have a type error that will blow up at runtime, same as usual. >> Var keyword = RT.var("clojure.core", "keyword"); >> Var hashMap = RT.var("clojure.core", "hash-map"); >> hashMap.invoke(keyword.invoke("foo"), 1, keyword.invoke("bar"), x); > > This one is more simple. This is clojure code. No, it's Java code, and butt-ugly Java code at that. > And the example shows what unnecessary boilerplate is required in Java which > Clojure hides from you. Everyone knowing how to call > a clojure function understands this code after learning how to get a Var from > a namespace and how to to invoke it. Capability of understanding isn't the issue. Speed of understanding is. It takes a lot longer to parse that. And it's harder to be sure it doesn't have errors. > For yours you have to know what x is. You have to quote it if you want to > pass it as a string. You have to escape various quotes in strings. You have > to know features of the reader. Your point being? You have to know this stuff to write functioning Clojure source code, too -- including what types you expect in what parts of your business logic. >> Nobody suggested using the reader in the cases where it is actually >> more compact to express using stuff like the above, by the way. > > Compactness says close to nothing about simplicity. In this case, it does. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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