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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 7 04:02:52 PDT 2010


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


Jacob Carlborg <doob at me.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |doob at me.com


--- Comment #5 from Jacob Carlborg <doob at me.com> 2010-07-07 04:02:46 PDT ---
(In reply to comment #4)
> I would expect that immutable and const variables would still be variables,
> just not mutable ones. If you wanted to know whether they were const or
> immutable, you could do a separate test for that on top of checking whether
> something was a variable, just like you'd do if you wanted to know whether it
> were static.
> 
> Personally, I've been trying to figure out how to get the list of non-static
> member variables out of a class at compile-time, and it's been a bit of a pain.
> And for what I'm doing with them, I wouldn't care whether they were immutable
> or const.

You can use object.tupleof to get a list of member variables of out a class at
compile time. You can also have a look at
http://www.dsource.org/projects/orange/browser/orange/util/Reflection.d (look
for the templates/functions containing "field") to get some ideas to implement
helper templates/functions.

-- 
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