is(this : myClass)
Steven Schveighoffer
schveiguy at yahoo.com
Fri Oct 20 23:01:25 UTC 2017
On 10/20/17 6:23 PM, Patrick wrote:
> On Friday, 20 October 2017 at 22:15:36 UTC, Steven Schveighoffer wrote:
>> On 10/20/17 5:55 PM, Patrick wrote:
>>> Due to the very specific nature of the 'is' operator, why wouldn't
>>> the compiler know to implicitly query the class types? Why must it be
>>> explicitly written, typeof(this)?
>>
>> The compiler generally doesn't "fix" errors for you, it tells you
>> there is a problem, and then you have to fix it. You have to be clear
>> and unambiguous to the compiler. Otherwise debugging would be hell.
>>
> Not asking the compiler to fix my errors.
>
> When would
> is(this, myClass) not mean: is(typeof(this) : typeof(myClass))?
class C
{
}
int c;
C myC;
is(myC : c);
oops, forgot to capitalize. But compiler says "I know, you really meant
is(typeof(myC) : typeof(c)) -> false.
-Steve
More information about the Digitalmars-d-learn
mailing list