[Issue 9521] Missed with() anti-hijacking

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 23 05:08:46 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=9521


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #2 from bearophile_hugs at eml.cc 2013-11-23 05:08:45 PST ---
(In reply to comment #1)

Sorry for my first example, that is badly written.


> void foo() is _not_ a local symbol.
> 
> An analogous version of the second example would be:
> 
> struct Foo { int x; }
> int x;
> void main() {
>     Foo f;
>     with (f) {
>         x++;
>     }
> }
> 
> Which does _not give an error.

Right, currently with() is not designed to have anti-hijacking of module-level
identifiers. So this issue is not a bug.

So is it a good idea to modify the anti-hijacking of with() and produce an
error even when you shade a global variable like that module-level x with the
field x of Foo?

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list