[Issue 1849] with() should cause shadowing errors if you use a member that's shadowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 3 00:29:36 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1849





------- Comment #4 from wbaxter at gmail.com  2008-03-03 02:29 -------
(In reply to comment #3)
> With the shadowing rules as they exist, it's a very local edit to change the
> name of something. But with with shadowing, it's not a local edit - you're
> looking at changing the member names, or names in some enclosing scope.

Right, which is why I suggest only issuing the shadowing error if the member
doing the shadowing is actually used inside the with{} block.

It's very dangerous the way it is.

Adding a member to an object in file A.d could cause behavior of code in B.d to
change, without creating any sort of compiler errors.  That seems to be the
kind of hijacking effect that usually gets you up in arms, but here you don't
seem so concerned about it for some reason.


-- 



More information about the Digitalmars-d-bugs mailing list