Hacker News new | ask | show | jobs
by frwrfwrfeefwf 18 days ago
>kotlin/Scala has html DSLs

these interpreted DSLs aren't at all what I'm talking about. The macro system should be able to compile arbitrary text into anything in the simplest possible way and have it seamless with the rest of the code + able to call into it and build off it.

A type system is paired with a language, not a global property. You can have language L1 with typesystem T1 compile into (L2,T2), etc. These typesystems can be domain specific and arbitrary as well.

After reading your posts I recommend you go ahead and learn common lisp macros, it will be more informative than more discussion.

1 comments

> go ahead and learn common lisp macros

Lisp macros used to be the one advantage Lisp had over other programming languages. However nowadays macros are common. There are even languages that has more than one flavour of macro system (Haskell has both a typed and non-typed flavour of macros).

However I personally prefer custom code generators instead of macros. The problem with macros, for the kind of large scale systems I work on, is understanding macros with N layers of abstraction, and also the compile/run time cost of using them.

Also, you can write code generators in any language and generate code for any language. Which is a huge advantage. I (for example) use code generators that generate C++, Java, Typescript, SQL, PDF's, interface descriptions, protocol specs etc. Whatever is required by a customer or other members of the team I can generate without demanding that they use a specific programming language.

Don't get me wrong. I love playing around with macros. However I have decided not to use them for real work.