2 problems I can't get my head around

Manu turkeyman at gmail.com
Mon Nov 26 08:17:36 PST 2012


On 26 November 2012 17:44, Adam D. Ruppe <destructionator at gmail.com> wrote:

> On Monday, 26 November 2012 at 15:39:35 UTC, Manu wrote:
>
>> Properties look like variables. How do I distinguish properties from
>> proper variables?
>>
>
> I think this will do it:
>
> import std.traits;
> bool isProperty = (functionAttributes!(S.P) & FunctionAttributes.property)
> ? true : false
>
>
>
> The way that works in the implementation is checking the mangled name of
> the function. I wouldn't try anything else because any other difference
> between a property and a variable is arguably a bug since they are supposed
> to be mostly interchangable!
>

That's weird. Why would I call functionAttributes in something that I can't
even identify as a function? That's almost self-defeating... but as long as
functionAttributes will tolerate being called with basically any argument,
function or otherwise, then I guess this is okay...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121126/bca973be/attachment.html>


More information about the Digitalmars-d mailing list