There once was a fork of Scalac, called Virtualized Scala. It expands Scala’s DSL capabilities by allowing to override keyword constructs like
while , etc.
Why macros aren’t enough?
The alternatives, mentioned in the related work force the user of the DSL library to annotate everything. Some kind of
object virtual encapsulation.
I look at my DSL requirement as a Scala/DSL hybrid. I want to program in Scala normally, and have DSL-specific classes, types, operators, etc. If I’m using a DSL type, that means I’m programming in DSL. So for me, any kind of annotation is redundant. Types are my annotations. That is the safest approach, IMO.
Fact is I can override a
+ operator according to the types, but not override an
if expression. I want to change this, and at the moment, there is no better alternative than modifying the compiler to do so.
This is a limitation of the language.
Development of Virtualized Scala stopped at 2.10.2. I want to re-implement some of the features which are not transparently available using macros.
An initial PR was submitted long ago for experimentation, but there seemed to be a little chance for this PR to be accepted, so the work was put on hiatus to explore other methods (possibly a compiler-plugin solution). However, recent closing of this PR initiated a discussion that provides some hope, along with another contributor, @namin.
Your feedback is needed
Are you interested in this language feature?
The PR discussion suggested that Spark could benefit from this SIP. How?
What other related features should be included in this SIP?