Vote++. It's also more readable. <br><br><div class="gmail_quote">On Thu, May 19, 2011 at 11:11 AM, Lars Tandle Kyllingstad <span dir="ltr"><<a href="mailto:lars@kyllingen.net">lars@kyllingen.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Several places in Phobos I've noticed tests like if(is(T==class)) that<br>
check whether T is a class type. I suspect it is usually meant for<br>
these tests to pass if T is an interface as well, but this is not the<br>
case. Doing<br>
<br>
grep 'is(\w\+\s*==\s*class)' *.d<br>
<br>
on the Phobos sources reveals many cases where the test for<br>
is(T==interface) has most likely been forgotten. This should be fixed,<br>
and I think the best way is to add the following to std.traits:<br>
<br>
template isClass(T)<br>
{<br>
enum isClass = is(T == class) || is(T == interface);<br>
}<br>
<br>
Most instances of is(T==class) in Phobos can then be replaced with<br>
isClass!T.<br>
<br>
What say you?<br>
<br>
-Lars<br>
<br>
_______________________________________________<br>
phobos mailing list<br>
<a href="mailto:phobos@puremagic.com">phobos@puremagic.com</a><br>
<a href="http://lists.puremagic.com/mailman/listinfo/phobos" target="_blank">http://lists.puremagic.com/mailman/listinfo/phobos</a><br>
</blockquote></div><br>