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 11:44:25 PST 2013


On Sunday, 24 November 2013 at 19:18:18 UTC, Walter Bright wrote:
> On 11/24/2013 10:52 AM, ilya-stromberg wrote:
>> We can allow shadowing members only for function parameters 
>> or, maybe, only for
>> constructor.
>
> We could, but at the cost of D becoming more of a mass of 
> special cases that nobody can remember.

See also:
http://d.puremagic.com/issues/show_bug.cgi?id=9801
Short description: disallow shadowing members, but provide 
special syntax for constructors like this:

struct S {
     int m;
     this(this.m) { }
}
Should be the same as your example above.

Other languages like Scala, CoffeeScript and TypeScript support a 
related but different syntax. So, not only I had problems with 
shadowing members.


More information about the Digitalmars-d mailing list