On 26 November 2012 18:44, Adam D. Ruppe <destructionator@gmail.com> wrote:
On Monday, 26 November 2012 at 16:32:17 UTC, Manu wrote:
And fail! functionAttributes breaks when I pass basically anything that's not a function >_<

Blargh.. they do that purposefully to, there's a check if(isCallable!T) on the thingy.


You could use that same check though: if !isCallable!T, it cannot be a property right now, so no need to do the other check.


template isProperty(T) if(isCallable!T) {
   enum bool isProperty = (functionAttributes!T & FuncAttribute.property) ? true : false;
}

template isProperty(T) if(!isCallable!T) {
   enum bool isProperty = false; // it isn't callable, so can't be a property
}

Error: variable isProperty cannot be read at compile time

...I think I give up. I can't afford to spend any more time on this.

TL;DR, std.traits is extremely brittle, and rather incomplete. As a programmer with deadlines trying to get work done, it is just not yet acceptable >_<