Shadowing of members

Jonathan M Davis jmdavisProg at gmx.com
Thu Jan 10 00:34:18 PST 2013


On Thursday, January 10, 2013 09:07:49 deadalnix wrote:
> Consider also that this is yet another inconsistency, which is a
> bad thing in itself.

What inconsistency? There's no inconsistency here. Is it that you think that 
the fact that the local variable shadows the member variable is an 
inconsistency? The _only_ case where variable shadowing is illegal is when one 
local variable shadows another local variable, and that's because you can't 
access the shadowed variable when that happens. In all other cases, you can 
access the shadowed variable (be it through the this pointer/reference or 
through . or by using the full import path to the variable). So, if anything 
is inconsistent, it's the fact that shadowing one local variable with another 
is illegal. It's legal with everything else and quite easy to work around when 
it happens.

Or are you arguing that something else here is an inconsistent? Because I 
don't see it, and I don't know what else from this thread that you could 
possibly be referring to.

- Jonathan M Davis


More information about the Digitalmars-d mailing list