-
-
Notifications
You must be signed in to change notification settings - Fork 651
Issue 9136 - Add isNested trait for aggregates and functions #1362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Seems reasonable to me. |
@9rnsr: If you find any gotchas -- it would be great to know so we can make this trait reliable from the get-go. |
All test codes for |
LGTM. |
@AndrejMitrovic: Indeed. For nested class type, checking |
Thanks, I was wondering where to put the testcase. Will update soon. |
Note: I've changed the implementation (sorry to reviewer Kenji). It was necessary to disallow invalid argument count, and invalid checks like e.g. |
I've rebased this again, after the tester is green we should try merging it. |
LGTM, but I would prefer to see a merged spec update first. |
I'll make the spec pull. Also I'm going to add another test-case which was missed: static class A { static class SC { } class NC { } }
static assert(!__traits(isNested, A));
static assert(!__traits(isNested, A.SC));
static assert(__traits(isNested, A.NC)); |
So this already works for classes, great. |
Issue 9136 - Add isNested trait for aggregates and functions
Updated |
http://d.puremagic.com/issues/show_bug.cgi?id=9136
This adds a new trait:
__traits(isNested, T)
, which is true for type T if it's a nested type which holds a context pointer (aggregate or function).Current library workarounds require using
.stringof
tricks, which probably isn't very reliable. This pull simplifies implementation of Phobos Pull 948.I'll add a documentation pull if & after this pull is merged.