On Thursday, 14 March 2013 at 17:53:42 UTC, Andrei Alexandrescu
wrote:
On 3/14/13 1:37 PM, deadalnix wrote:
On Thursday, 14 March 2013 at 17:07:16 UTC, Andrei
Alexandrescu wrote:
Very simple. Traditionally there's two crucial epochs known as
compilation time and run time. (There's some minor
distinctions like
link time etc.) The whole notion of concepts and other type
systems
for templates is predicated on three crucial epochs: library
compilation time, library user compilation time, and run
time. The
logic goes, someone writes a generic library and wants to
distribute
it to users. Users shouldn't ever see bugs caused by e.g.
typos in the
library.
I'm not sure if you are thinking I'm really stupid here.
Being wrong doesn't make one stupid.
I may be wrong, but certainly not because I don't make the
difference between compile time and run time.
Template constraints are D's solution to that issue. I agree
it's not perfect, but I think dollar for dollar it's better
than concepts.
No they aren't, because it would only skip the top most lines and
replace the error by something like impossible to find method
blah.
With something like concept, I'd have something like in case of
eroneous template :
file:line: Error: concept Blah don't have member blah.
Or in the case of unmatched constraint :
file:line: Error: template Blah except a concept argument of
meta-type Foo, Bar given.
And in both cases you can avoid the dreaded wall of error.