On 2013-08-28 01:53, captaindet wrote:
i admit that i am not very good at reading/understanding language
definition syntax. but yet i think the given enum specs (
http://dlang.org/enum.html ) are not quite in order.
they seem to imply that both
enum ;
enum WhatAmI ;
That doesn't look entirely correct. Currently the docs read:
EnumDeclaration:
enum EnumBody
Should probably be:
EnumDeclaration:
enum EnumMembersBody:
are correct. while the first one throws an error as expected, the second
one passes and is partially usable, potentially similar to C's #define
OPTION. however, typedef's throwing of an error makes me doubt that this
is legal:
----
import std.stdio, std.traits;
enum test; // passes but is it really legal?
int main(string[] args)
{
writeln( __traits(compiles, test) ); // true
writeln( is( test == enum ) ); // true
writeln( isBasicType!(test) ); // true
writeln( isSomeFunction!(test) ); // false
// writeln( typeof(test).stringof ); // Error: argument
test to typeof is not an expression
return 0;
}
The last one will fail since "typeof" expects an expression and not a type.
--
/Jacob Carlborg