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.

So the crowd that use meta-type systems is formed of library writers
who want to distribute libraries without ever instantiating them. I
don't think that's a good crowd to cater for.

I've been surprised to figure how many people don't get this flow, or
only have a vague image of it. Although meta-types are arguably "the
right thing" to do, they're a lot less attractive once it's clear what
scenarios they help.


Let me demonstrate with an actual example :
[snip]
Yes I added the bar on purpose in some heavily templated code. You
concentrate too much on theses people that want to ship code without
using it. They'll do it anyway.

And that make even more sense from the lib user perspective, as having
the compiler vomit kilometers of internals of a lib is usually not
helpful (this happen a lot with phobos).

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.

Andrei

Reply via email to