Better docs for D (WIP)

default0 via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Dec 30 09:34:16 PST 2015


On Wednesday, 30 December 2015 at 16:41:51 UTC, Adam D. Ruppe 
wrote:
> BTW wouldn't it be great if the compiler's error messages 
> showed each level of pass/fail for those constraints? For the 
> docs, I don't mind doing a few special case, hand written 
> things, but the compiler needs something a bit more generic.
>
> I think the way to code that is whenever the compiler is 
> printing an expression that can convert to bool, color it based 
> on the result, and do this through the whole tree from the 
> bottom up.
>
> Then the use could tell at a glance which parts succeeded and 
> failed when reading the error message.
>
> It'd be kinda nice if it showed the result of non-bool things 
> too but that's going to be hard to do on a console without 
> becoming a wall of text, even with whitespace formatting...
>
>
> But the compiler will come later, for now I gotta do docs!

I was personally thinking that it can't be horribly difficult 
that given a function signature:

void foo(T)(T arg) if(constraintA!T && constraintB!T || 
constraintC!T)

That if this cannot be instantiated the compiler prints something 
like
"Candidate foo(T)(T arg) fails with (true && false || false)"
I sometimes found myself putting static 
assert(<copy-pasted-segment-of-constraints-with-my-type>, "Result 
is blabla") and recompiling just to debug these :/


More information about the Digitalmars-d-announce mailing list