2 problems I can't get my head around

Manu turkeyman at gmail.com
Mon Nov 26 09:03:33 PST 2012


On 26 November 2012 18:44, Adam D. Ruppe <destructionator at 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 >_<
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121126/3f4c2690/attachment.html>


More information about the Digitalmars-d mailing list