is(this : myClass)
Patrick
tengai650 at gmail.com
Sat Oct 21 16:27:37 UTC 2017
>
> But with the current compiler you would never write
>
> is(typeOf(myC) : typeof(c))
>
> if in your mind "c" is actually a class "C" because if that is
> in your mind you would just write
>
> is(typeof(myC) : c)
>
> which would get you the error. You only need typeof(variable)
> to get to the type, there is no point in doing typeof(type),
> you just write type and C is a type. Right?
But what value is evaluating a class type to a primitive type? It
will never be true? There has to be a reasonable chance for the
evaulation to be true for the 'is' operator to provide value. The
compiler should reject this 'is' statement or at minimum issue a
warning of incompatible types. This is nonsense creep of unusable
code (being able to write code that has no meaning and value).
This is equivalent to writing code like the following. It is just
more obfuscated:
if(false)
{
...
}
else
{
...
}
Patrick
More information about the Digitalmars-d-learn
mailing list