Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Haskell, OCaml, probably F# too.

Lisp has macros, read-macros, and eval. These things enable DSLs. You're saying strongly-typed functional languages have features of equivalent power for this purpose?



Yes, for example F# has quotations, type expressions and type providers.

Also .NET has attributes, compiler plugins and expression trees, which allow to do some kind of similar stuff even for C#, although not as straightforward as in Lisp.

On the Java side, you also get the attributes (aka annotations), compiler plugins, AOP (yay CLOS interceptors).

Haskell has Template Haskell and OCaml has ppx extensions.


Those are so distant to what Lisp macros achieve. Also, I can't believe you brought up Java annotations in this discussion.


They are, but as they say back home, those who don't have dogs, hunt with cats.


Writing EDSLs (E for embedded) is fairly common in Haskell. I don't know if it's as easy as with Lisp macros though since I have no exposure to that.

Many DSLs are written on Haskell (Elm and Purescript come to mind) as well.


It's all about ergonomics though. In Lisp, it's super easy, and even fun with macros. They can probably do roughly equivalent things in the other languages, but it's so fucking painful it's relegated to rare use and for relatively short code sections.

For Lisp users, it's like holding the knife by the handle. For them it's like holding the knife by the blade.


Hum... Yes.

Not exactly equivalent, but monad-based DSLs have almost the same power as Lisp macros.

You can't escape the syntax restrictions, the same way you can't escape Lisp's syntax restrictions. And it's a bonus for Lisp (in power) that its syntax is much more flexible. But in semantics they are equivalent.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: