Better mixin error messages

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 17 14:23:58 PDT 2016


On 17.04.2016 23:18, Bauss wrote:
> Can there please be implemented something to retrieve the generated
> mixins that causes compiler errors; like perhaps a flag you pass that
> will print all mixins with compiler errors?
>
> Sometimes when you create highly dynamic mixins it can be hard to
> identify errors in them, because you might not know exactly what code is
> generated.
>
> I've had that issue multiple times with big mixins and it has been
> impossible to determine what the exact culprit of it is. I mean you get
> the line and stuff within the mixin, but sometimes that's not enough
> because you simply don't know the exact mixin string that's compiled.
>
> Of course you can generate the mixin strings at runtime and print them
> out, but it can be a real hassle to translate compiletime data into
> runtime data to be able to generate the exact mixins. Sometimes it might
> not be an option either if your mixins rely on other mixins or simply
> because the data you rely on is too difficult to move.
>
> I believe it would make compiler errors easier to handle for mixins if
> you could see the generated mixins, because you could pinpoint the issue
> to its exact location.
>
> This might not be something that you face with small mixins, but I often
> deal with mixins of 100s - 1000s lines of code and it becomes really
> hard to deal with errors in them because I don't know what they exactly
> consists of.


mixin(generate());
pragma(msg,generate());


More information about the Digitalmars-d mailing list