Ensuring template argument is descendant of class

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Dec 12 16:04:31 PST 2013


On Thu, Dec 12, 2013 at 11:23:15PM +0100, Adam D. Ruppe wrote:
> On Thursday, 12 December 2013 at 22:05:17 UTC, Ross Hays wrote:
> >http://dlang.org/expression.html#IsExpression and had no idea is
> >could be used with that syntax. The more D I learn the more
> >counter-intuitive I find some aspects of the language syntax.
> 
> Yeah, the is expression is one of the strangest things in D.
> Especially if you use it to deconstruct arrays and templates! But
> between the two simpler forms of is(A == B) and is(A : B), and
> http://dlang.org/phobos/std_traits.html you can get a lot done and
> it isn't so bad looking.

Yeah, is-expression syntax is one of the dark, ugly corners of D that
unfortunately we're stuck with, because changing it now will totally
break a LOT of code for merely cosmetic reasons. I honestly wish that
one day this mess could be cleared up, though I'm not holding my breath
for it.


T

-- 
"Computer Science is no more about computers than astronomy is about
telescopes." -- E.W. Dijkstra


More information about the Digitalmars-d-learn mailing list