IsExpression
Luís Marques
luismarques+spam at gmail.com
Mon Mar 12 16:40:36 PDT 2007
Hello,
The documentation of IsExpression lists the following valid forms:
is ( Type )
is ( Type : TypeSpecialization )
is ( Type == TypeSpecialization )
is ( Type Identifier )
is ( Type Identifier : TypeSpecialization )
is ( Type Identifier == TypeSpecialization )
What about the form "expression is expression"? I cannot find
documentation for that form. What are its semantics? "exp is null" is an
obvious one. But what about other forms?
- for classes it seems that "obj1 is obj2" is equivalent to "&obj1 ==
&obj2". Can I rely on that? I have a singleton called "nil", so it's
great being able to say "obj is nil".
- for structs "structvar1 is structvar2" is always true.
- for PODs it seems that values must be semantically equivalent. For
instance, "1L is 1.0+0i" is true.
Could this be documented?
Also, the IsExpression docs refer to a "Type", which can be an
identifier (e.g. "int x; writefln(is(x));" is valid, even though the
form in question is "is(Type)"). Perhaps that could be made more clear?
Regards,
Luis
More information about the Digitalmars-d
mailing list