Constrained Templates
Nick Sabalausky
a at a.a
Sun Jun 13 20:52:11 PDT 2010
"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message
news:hv46bv$1kpl$2 at digitalmars.com...
> Walter Bright wrote:
>> Nick Sabalausky wrote:
>>> "and a line number pointing into the template body. The error is being
>>> reported as occurring somewhere other than where the actual problem is"
>>>
>>> That would be a good place to point out that recent versions of DMD
>>> display template instantiation traces upon template instatiation errors
>>> (Does C++ do that?). Then, of course, it could go on to "but better
>>> yet...".
>>
>> I wished to avoid quality of implementation issues, and instead focus on
>> characteristics of the language.
>
> I think Nick does make a valid point: there is access to the error, it
> just takes some more info from the compiler.
>
My concern was that C++ users (or other non-D-users) might get the mistaken
impression that without constraints, *all* they would get is the unhelpful
"Error: incompatible types for ((a) % (b)): 'int*' and 'int*'", and
re-enforce their belief that templates have an innate tendency to give
useless error messages, and that if you use D, constraints are the only help
you get.
But I may be over-thinking it and worrying about nothing.
More information about the Digitalmars-d
mailing list