2 problems I can't get my head around
Manu
turkeyman at gmail.com
Mon Nov 26 07:39:27 PST 2012
On 26 November 2012 14:31, Manu <turkeyman at gmail.com> wrote:
> 1.
>
> enum i = 10;
> pragma(msg, is(i == enum) || is(typeof(i) == enum)); // <- false?!
>
> I can't find a way to identify that i is an enum, not a variable; can not
> be assigned, has no address, etc.
>
>
> 2.
>
> import std.stdio;
> pragma(msg, !is(std) && is(typeof(std))); // <- true?!
>
> std.stdio is a module, it looks like a variable. typeof(std) == void...
> What the? Why does it even have a type?
> I can't find a sensible way to distinguish std from any other regular
> variable.
>
And a new one!
3.
Properties look like variables. How do I distinguish properties from proper
variables?
struct S
{
@property int P() { return 10; }
}
pragma(msg, is(typeof(S.P) == function)) // false?!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121126/cae118bc/attachment-0001.html>
More information about the Digitalmars-d
mailing list