[Issue 9065] Please consider adding these std.traits
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Nov 24 14:35:55 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9065
--- Comment #7 from Manu <turkeyman at gmail.com> 2012-11-24 14:35:53 PST ---
(In reply to comment #6)
> is(T == function) actually tests whether T is the type of a function, not
> whether it's a function pointer. This stackoverflow question discusses the
> differences between is(T == function), isFunctionPointer!T, isDelegate!T, and
> isSomeFunction!T:
>
> http://stackoverflow.com/questions/11067972/functions-versus-function-pointers-whats-the-difference
Looking at that link, what's with all the typeof(bar) stuff? Do those tempaltes
not work by alias? Surely I should be able to say isSomeFunction!bar, not
requiring isSomeFunction!(typeof(bar)) ?
Using typeof() like that makes generic code harder, because 'bar' could be
anything, and if it doesn't have a typeof, then it is a different compile error
and I have to produce even more logic prior to eliminate that case. Surely that
could be encapsulated?
> A related issue is issue# 4427
>
> We may want to add more of these to std.traits, but we should probably think
> carefully about exactly what we should add, especially because is expressions
> do most (all?) of it already, and often fairly cleanly. It's just that they're
> complicated enough in general and not understood well enough, that many people
> don't have a clue what they can do. It still may be worth adding stuff like
> isVariable to std.traits though.
In my experience, code to the effect of isVariable is actually rather
non-trivial. It would be very useful. Ideally, written by someone who knows
what they're doing ;) (I clearly don't)
--
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