On 26 November 2012 18:44, Adam D. Ruppe <span dir="ltr"><<a href="mailto:destructionator@gmail.com" target="_blank">destructionator@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">On Monday, 26 November 2012 at 16:32:17 UTC, Manu wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
And fail! functionAttributes breaks when I pass basically anything that's not a function >_<<br>
</blockquote>
<br></div>
Blargh.. they do that purposefully to, there's a check if(isCallable!T) on the thingy.<br>
<br>
<br>
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.<br>
<br>
<br>
template isProperty(T) if(isCallable!T) {<br>
enum bool isProperty = (functionAttributes!T & FuncAttribute.property) ? true : false;<br>
}<br>
<br>
template isProperty(T) if(!isCallable!T) {<br>
enum bool isProperty = false; // it isn't callable, so can't be a property<br>
}<br>
</blockquote></div><br></div><div class="gmail_extra">Error: variable isProperty cannot be read at compile time<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">...I think I give up. I can't afford to spend any more time on this.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">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 >_<</div>