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 10:52:33 PST 2013


On Sunday, 24 November 2013 at 18:23:51 UTC, Walter Bright wrote:
> Shadowing globals is definitely a bad idea. Shadowing members, 
> it's debatable. In any case, I don't think it is some sort of 
> terrible bug generator. In fact, I'll often write:
>
> struct S {
>     int m;
>     this(int m) { this.m = m; }
> }

We can allow shadowing members only for function parameters or, 
maybe, only for constructor. Probably, your example is the most 
often case usage of shadowing members. In other hand, I can 
always rename local function variable because it isn't part of 
public API and should not confuse any users.


More information about the Digitalmars-d mailing list