4 ms·
This is a significant breakthrough. Scala is once again showing the way forward. Instead of having ad hoc macros (which everyone knows are bad), Scala macros do
by wbhart 15y ago
This is a significant breakthrough. Scala is once again showing the way forward. Instead of having ad hoc macros (which everyone knows are bad), Scala macros don't change the syntax of the language. Thus they are no more difficult to come to terms with than an API for a well-written library. In this sense ordinary API's are going to start looking like crippled Scala.
The other nice thing about these is that you don't need to lose type safety to use macros. That's really where the innovation is here.
I don't yet fully understand how this all works at the type-theoretic level. I'm imagining that expressions (as opposed to the values they represent) are thought of as belonging to higher kinded types. The macros then reject expression which aren't of the right kind.
I have to say, I am absolutely flawed by the comments so far about this. I think this is going to have an absolutely pivotal effect on future programming languages. This is how macros should always have been. I don't know of any other language which does this. It's a totally new area in language theory to explore.
- draegtun 15y agoThis is how macros should always have been. I don't know of any other language which does this They look very similar to Perl6 macros. See recent discussion here: http://news.ycombinator.com/item?id=3124920 http://news.ycombinator.com/item?id=3124920