tag:blogger.com,1999:blog-8814261378695867419.post4947356317079684065..comments2023-02-28T00:33:36.443-08:00Comments on Kent Tong's personal thoughts on information technology: Reaction to "Clojure: Towards The Essence Of Programming" from a ScalaperspectiveAnonymoushttp://www.blogger.com/profile/07077712132467251275noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-8814261378695867419.post-26609056866764906042011-08-29T06:56:46.000-07:002011-08-29T06:56:46.000-07:00Hi Nicolas,without the "containing" meth...Hi Nicolas,<br>without the "containing" method, how would it figure out that the child nodes should belong to <p> or some ancestor?Kent Tonghttp://agileskills2.orgnoreply@blogger.comtag:blogger.com,1999:blog-8814261378695867419.post-46700157970217945182011-08-29T01:18:06.000-07:002011-08-29T01:18:06.000-07:00You didn't put equivalent example for clojure ...You didn't put equivalent example for clojure and scala "DOM" DSL. This look like clojure DSL is somewhat more verbose because the example used if more complex for clojure. <br>Well in fact clojure DSL is more consise and natural. The equivalent of your scala example can be expressed with :<br>[:p { :style "color: red"}] [ "This is an" :b [ "interesting" ] " dom tree" ] <br>In particular we avoid completely the unatural "containing" part of your scala example.<br>Because clojure use macros, it can transform the input of macro in any way required. We doesn't need dummy functions anymore to glue things together (like your "containing"). And because computation can be done at compile time, and the nice looking of DSL doesn't impact runtime execution. In particular the last example at execution would be simply replaced by a string after macro expansion, nothing more. You can see we need neither commas. You can add comma if you want for readability, and parens are needed only if you do want to call some function, not the case here.Nicolasnoreply@blogger.comtag:blogger.com,1999:blog-8814261378695867419.post-78642801590760577102011-08-28T17:46:46.000-07:002011-08-28T17:46:46.000-07:00I understand this talk not as a demonstration of h...I understand this talk not as a demonstration of how Clojure solves Java's problems, but how you get to the essence of problem-solving in a programming language. In Clojure you don't create wrappers around the problem (see the Comparator example, or Scala's touring-complete type system) or you don't invent DSLs that you have learn like a second (mini-) language. In Clojure, all problem-solving is based on several ubiquitous low-level abstractions (list, vector, map, ...). Even DSLs use them.<br>I like Scala a lot, but this talk demonstrates nicely why I like Clojure a bit better :)Mariusnoreply@blogger.com