On Monday, 26 November 2012 at 15:39:35 UTC, Manu wrote:
On 26 November 2012 14:31, Manu <[email protected]> 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?!

http://dlang.org/phobos/std_traits.html#functionAttributes

Reply via email to