On 2013-01-22 20:51, Andrei Alexandrescu wrote:

Not at all, I'd say. CTFE has a much lower cost of learning - you only
need to know which subset of D is allowed. Maybe you meant code mixins?

To be able to use AST macros one needs CTFE. One needs functions to manipulate the AST during compile time. As far as I understand it, in Scala they just create a new instance of the compiler, during compilation, and just like that they have access to the whole language during compilation.

In D it feels like a feature first need to be implemented in the regular compiler. Then it needs to be duplicated to be able to be used as CTFE.

Example, in Scala if you throw an exception during compile time it will be handled properly and generate a compile error. What happens if you do the same in D? It won't run the function during compile time?

Techincally you can generate an empty AST just to be able to run a bunch of functions during compile time. This would be no higher cost of learning than CTFE in D.

--
/Jacob Carlborg

Reply via email to