July 21, 2017 [Issue 13216] Failed anti-hijacking of with statement | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13216 Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Hardware|x86 |All OS|Windows |All -- | ||||
November 09, 2020 [Issue 13216] Failed anti-hijacking of with statement | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13216 Mathias LANG <pro.mathias.lang@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |pro.mathias.lang@gmail.com Resolution|--- |INVALID --- Comment #1 from Mathias LANG <pro.mathias.lang@gmail.com> --- This works as intended. I think you are confusing two notions: hijacking and shadowing. We prevent hijacking by making sure a change in a different module will not suddenly change the symbol being called, but keep the same behavior or result in an error. There's no hijacking protection within a module itself. However we have shadowing protection. We make sure not to allow a more nested scope to override a scope name from an outer scope, as long as this outer scope is in the same function. However, `with`'s whole point is to bypass this. An object used in a `with` clause will be searched first for this scope. Erroring on shadowing would render the feature completely useless and unreliable. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply