On 1/9/2016 2:49 AM, Russel Winder via Digitalmars-d wrote:
The D code as presented is clearly simpler and easy to read. However
the D grammar is a string and not code so the anticipation is that
errors in the C++ code would be easier to find and correct. I guess the
question here is how good the compile time evaluation of strings is in
D and does it do good error reporting.

The compiler does not report the errors. The parsing is done by code supplied by the module, and the error messages are as good or as bad as that code is written. The point being that one is not subjected to compiler generated error messages based on the compiler thinking it is C++/D code, but a custom written parser for the DSL that can give messages specific to the DSL.


I still prefer the concept of Internal DSL explicitly in the code
rather than in strings just now, but this may still just be prejudice.

I can see only one advantage to using ETs for DSLs:

* 3rd party tools like syntax directed editors, formatters and highlighters will operate on it. But they'll still operate on it as if it were C++ code.

CTFE based DSLs win on every other point I can think of, including error 
messages.

Reply via email to