Hi,

Trying to improve my CT-fu, I looked at a DSL example (chapter 9) in Adam's D-Cookbook. Although I am sure Adam's original examples would have worked, there were some errors in the example code in the book.

The example also contains some code to allow you to test the functions at RT, which had an error i.e. I had to change this...

        writeln(parse(code));           // to aid with debugging
        writeln(convertToD(parse(code)));       // debugging aid
..to..
        writeln(parse(code)[]);         // to aid with debugging
        writeln(convertToD(parse(code))[]);     // debugging aid

..to match the actual function arguments. So that worked fine.

However I could not get the CT version to work with the current version of DMD i.e. this [1]...

[1] https://run.dlang.io/is/dyElXg

...fails with:
onlineapp.d-mixin-36(38): Error: template argument expected following ! onlineapp.d(48): Error: template instance onlineapp.runDslCode!"5 5 + 3 - 2 * 1 + 3 /" error instantiating.

I find the error message a bit lacking as to the real cause - I really cannot see where the "template argument expected following !" error is. It all looks correct to me.

In addition the RT version is working correctly (after fixing the above bug), so that is not helping in identifying the error - particularly since it is failing in the only CT specific function not used/called at RT. So I am not sure how to debug this.

Can somebody please put me out of my misery here?

Thx!

Reply via email to