A look at the Arc language

While I love to code in Python, I think it's good to step out and see what others are doing. Tonight I have looked a bit at Paul Graham's Arc language, which is a dialect of Lisp.

If you download Arc and look into news.arc you'll see how Arc code looks like. I think a lot of the code in news.arc is pretty beautiful and a lot different than what you would see in the typical Python, Ruby or Java web-application.

I think the most interesting aspect of Arc (and Lisp in general) is that you build a domain specific language. For example, here is how HTML is generated in Arc:

(def color-stripe (c)
  (tag (table width "100%" cellspacing 0 cellpadding 1)
    (tr (tdcolor c))))

Most of the other code is also pretty domain specific as well, e.g.:

(def rerank-random ((o depth 15))
  (when ranked-stories*
    (adjust-rank (ranked-stories* (rand (min depth (len ranked-stories*))))))
  (save-topstories))

While you can create DSL's in Python or Ruby, I think DSL's are far more powerful in Lisp, since they are built-in Lisp's DNA (due to the nature of S-expressions).

Will Arc (or another Lisp dialect) become the new hot language? I doubt it, since they are very alien for most of today's programmers. But I think DSL features will be added to upcoming mainstream languages - Ruby has decent support and something like Perl 6 will put a lot more power into a programmers hands.

Code · Interesting 21. Sep 2008
© Amir Salihefendic. Powered by Skeletonz.