Early exit error messages are unsustainable
Ethan
gooberman at gmail.com
Tue Aug 13 21:00:38 UTC 2019
SOOOOOO
Since not many liked the idea of static assert behaving correctly
(note for reference that C++'s static_assert will not stop
compilation in at least MSVC and will give you all the error
information you need), here's another example that's currently
driving me up the wall.
Error: template instance `AliasSeq!( ... )` recursive template
expansion
This one's the result of trying to compile my code in LDC.
Symbols omitted because they're not important.
What is the important part? As a part of dealing with "recursive
template expansion" last time the compiler didn't want to give me
information, I determined that an AliasSeq will give that error
if something fails to compile.
While tracking down another error, I discovered that LDC has
issues with cross-module visibility and alias this. This code
compiles just fine in online compiler testers:
struct Something
{
enum Val = 5;
int dummy;
}
struct SomethingElse
{
Something derp;
alias derp this;
}
pragma( msg, SomethingElse.Val.stringof );
But put it across modules (and, in my case, template the
equivalent of SomethingElse) and things start going wrong in LDC.
Which leads me to the recursive expansion. Because whatever's
going on wherever in my code, the compiler knows there's a
problem and is refusing to tell me.
This code should have been compiling hours ago, and I should have
been uploading this binary not long after.
These instances of the compiler stopping have cost me too much
time. Counter arguments to this are just plain incorrect. Any
given compiler *needs* to tell the user *why it's not compiling
code*.
As it stands, it's a crapshoot hand-auditing about 10,000 lines
of heavily templated D code right now trying to find out what the
actual problem is. This is neither a fun nor entertaining nor
productive use of my time.
More information about the Digitalmars-d
mailing list