Shadowing of members

Mehrdad wfunction at hotmail.com
Wed Jan 9 16:13:42 PST 2013


On Wednesday, 9 January 2013 at 22:25:53 UTC, Jonathan M Davis 
wrote:
> On Wednesday, January 09, 2013 23:22:19 Andrej Mitrovic wrote:
>> On 1/9/13, Walter Bright <newshound2 at digitalmars.com> wrote:
>> > It is not a bug.
>> 
>> Something related I want to ask you about:
>> 
>> struct S
>> {
>> int _m;
>> this(int m)
>> {
>> this._m = _m; // meant "this._m = m;"
>> }
>> }
>> 
>> I'd like to add a warning for identity assignments when it 
>> involves a
>> parameter and a field of the aggregate which is the parent of 
>> the
>> function. This was filed as
>> http://d.puremagic.com/issues/show_bug.cgi?id=4407.
>
> Why not just prevent identity assignments altogether? What 
> would be the
> purpose of even allowing a variable to be assigned itself? I 
> see no reason to
> single out parameters or member variables for that.
>
> - Jonathan M Davis


It's very useful as a no-op when debugging.


More information about the Digitalmars-d mailing list