On Fri, May 20, 2016 at 01:26:31AM -0700, Walter Bright via 
Digitalmars-d-announce wrote:
> On 5/19/2016 11:50 PM, Manu via Digitalmars-d-announce wrote:
> > Ah. Okay, well while this is a very interesting talk, I was indeed
> > hoping you were going to make a D concepts proposal... do you have
> > such a thing in mind, or are you against concepts in D?
> D has constraints.  No point in adding concepts.

Constraints have been a headache when it comes to generating
user-friendly diagnostics. Not to mention inconsistency in what exactly
is being tested for: if you want to check if something is an input
range, do you use is(typeof(R.empty)), etc., or should you use
__traits(compiles, R.init.empty), or is it is(typeof((R r){r.empty;})),
or any of the 15 or so slightly different ways of testing for the
existence and type of some aggregate member, all subtly different from
each other? Subtly different as in, for instance, testing for
is(typeof((){R r; bool x = r.empty;})) is different from is(typeof(R
r){bool x = r.empty;}), because the former doesn't work with R that has
parameters closing over a local scope, whereas the latter does.

And none of this has even begun addressing the issue of human-readable
diagnostics.  Whereas if D had concepts, it would have been a simple
matter of defining the prototypical range with struct-like syntax and
calling it a day.

(I still think sig constraints are awesome, though. Just not to the
point of replacing concepts. I don't see them as being mutually
exclusive. In fact, they would complement each other quite nicely.)


Not all rumours are as misleading as this one.

Reply via email to