[Issue 4427] __traits should have isFunction, isVariable, etc

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 16 15:46:49 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=4427



--- Comment #7 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-11-16 15:46:47 PST ---
I had forgotten that I created this enhancement request, though I don't know
how valid it is at this point given how powerful is expressions are (though how
to fully use them isn't well enough known).

> I wasted an hour on this very issue because it's not obvious in the least how
> to do something like isStruct() for a template constraint.

> I don't mind using is( T == struct ), so long how to do such a thing (and
> other tests) is documented in an obvious place that someone is going to look 
> at, like in the templates constraint section. That section currently has 
> nothing in it of much help other than showing how to constrain a few basic 
> types.

It's explained in the section on is expressions:

http://dlang.org/expression.html#IsExpression

However, that documentation is fairly sparse, and given the extreme flexibility
and power (and therefore complication) of is expressions, we could really use a
solid tutorial on them on the site. Phillippe Segaud has an extension tutorial
on templates in general on github though:

https://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/dtemplates.pdf

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list