Skip to content

Common Lisp’s quote

Directly from Practical Common Lisp:

DOLIST is similar to Perl’s foreach or Python’s for. Java added a similar kind of loop construct with the “enhanced” for loop in Java 1.5, as part of JSR-201. Notice what a difference macros make. A Lisp programmer who notices a common pattern in their code can write a macro to give themselves a source-level abstraction of that pattern. A Java programmer who notices the same pattern has to convince Sun that this particular abstraction is worth adding to the language. Then Sun has to publish a JSR and convene an industry-wide “expert group” to hash everything out. That process–according to Sun–takes an average of 18 months. After that, the compiler writers all have to go upgrade their compilers to support the new feature. And even once the Java programmer’s favorite compiler supports the new version of Java, they probably still can’t use the new feature until they’re allowed to break source compatibility with older versions of Java. So an annoyance that Common Lisp programmers can resolve for themselves within five minutes plagues Java programmers for years.

3 Comments

  1. Giovanni Corriga wrote:

    As a Smalltalker, I can’t but feel smug when reading this ;-) Long live #do: !

    Friday, September 29, 2006 at 7:03 pm | Permalink
  2. Lawrence wrote:

    I will try to learn Smalltalk one day… maybe in my 30s… :-P

    Friday, September 29, 2006 at 7:12 pm | Permalink
  3. RiK0 wrote:

    In fact Lisp’s syntax allows this sort of things quite easily. However, I would like to point out that Ruby does something similar quite often: for example loop is not a language construct but a Kernel method.

    Moreover, you could define some other control structures in terms of a subset of them. That is you can do this while preserving almost the same syntax (just defining them is trivial in — almost — any language)

    Of course, in Lisp you need none of them since you have recursion (I mean recursion is well optimezed and it is a common way to do things in Lisp).

    This is a Haskell naive if

    newif :: Bool -> a -> a -> a newif True then_ _ = then_ newif False _ else_ = else_

    of course you can’t place then else keywords in it, but it’s quite readable (and it has a syntax similar to Lisp if — with less (((parentheses))))

    However, the paragraph is really interesting and should make us reflect.

    Monday, November 6, 2006 at 12:59 am | Permalink

Additional comments powered by BackType