DMD can implicitly convert class pointer to the bool. Is it bug or terrible feature?

ilya-stromberg ilya-stromberg-2009 at yandex.ru
Sun Nov 24 07:01:32 PST 2013


On Sunday, 24 November 2013 at 14:50:28 UTC, Maxim Fomin wrote:
> This is identifiers shadowing issue. In best case you could not 
> define boolean f, so the problem would not arise in a first 
> place.

Yes, I agree that it's also can be identifiers shadowing issue. 
But we allow code like this:

class Foo
{
	int i;
	
	this(int i)
	{
		this.i = i;
	}
}

> Anyway, many artifical examples can be provided which shows 
> that some features behave in unexpected ways which is not a 
> reason that they are bad.

I repeat, this is REAL LIFE example. I just reduce it because it 
have unnecessary details for this case.


More information about the Digitalmars-d mailing list