Does macros support make Scala a Lisp dialect

language-designlispmacrosscala

I've read recently that macro support in Scala is now official. I checked the documentation page and they are reminiscent to the LISP ones. In one of his essays Paul Graham writes that when "you add this final increment of power" to a language it is no longer a new one but a lisp dialect.

Is this the case with Scala? It does not seem like a LISP dialect to me and the macro support in Scala is somewhat awkward for me.

Best Answer

The Lisp family of languages is a fuzzy concept. The key aspects seems to be

  1. Support for functional programming
  2. Macros
  3. Homoiconic (The text <=> The AST, eg Lisp's love of parens)
  4. Dynamically typed
  5. Garbage Collected

The big place where Scala falls down in is 3. Scala is hilariously not homoiconic and this is not a bad thing necessarily.

It does have one major effect though: in Lisps, part of what makes macros so powerful is that they're so easy. In common lisp a macro is literally a function that returns a list. That's it.

In Scala or Haskell (Template Haskell), compile time meta programming is something that experts do, in Lisp, macros are what everyone does.

Scala also fails 4 being very strongly statically typed. There are pragmatic ways that you can convince the compiler to accept some level of dynamic typing, but you're definitely fighting the language then.

My thought is that Scala, like many, is influenced by Lisp, but it isn't a dialect.