4 ms·
I think "Lisp has no syntax" is an unfortunate meme. Lisp has a syntax. It's a very simple syntax for defining trees, and you're basically using it to write the
by scott_s 16y ago
I think "Lisp has no syntax" is an unfortunate meme. Lisp has a syntax. It's a very simple syntax for defining trees, and you're basically using it to write the abstract syntax tree for your program, but it still has a syntax.
- kgo 16y agoYes of course, but in the context of a DSL, you're not really defining a new syntax. You've still got an AST at the end of the day. And of course, this isn't an attack on lisp. If it works for you, cool. But I just don't see how that distinguishes itself from a ruby DSL like say rspec. I think the nicest feature of lisp DSLs is that lisp doesn't have the concept of an operator, and most langaguages make if difficult to define a function called or <- or something like that. But you can do that in Haskell or or ML, it's not really exclusive to S-exps.
- scott_s 16y agoI'm unfamiliar with rspec, but the major difference between designing and implementing DSLs in Lisps versus other languages is ease of code generation. That is, actually generating new code based on what the user of the DSL supplies. In Lisp, this is done because it's trivial to receive the AST that defines what the user wants to do. Then you can generate code directly based on that AST. No need for reflection or any such trickery because it's all just lists of list. In most other languages, if that sort of transformation is even possible, it is much less direct.
- ScottBurson 16y agoI think it's more accurate to say that Lisp has a metasyntax rather than a syntax. Each special form and macro, including user-written macros, has its own syntax; but all of these syntax are layered on top of the standard metasyntax.
- gnaritas 16y agoThis is a good point, and it's one of the things I don't like about Lisp. You can't know the semantics of evaluation without memorizing each form or having a doc handy. The code at the call site itself is not enough.
- scott_s 16y agoInterestingly, that's similar to the criticism often levied at operator overloading in C++.
- gnaritas 16y agoSimilar, but different. Operator overloading doesn't affect evaluation. You know immediately what is being evaluation now and what isn't, not so in Lisp, and this matters a great deal.