Yet another example of somehow who got bitten hard by using the with statement (I decided to give with its own category on my blog).
This time it got shared by Paul Foster on G+ and comes down to this:
Even in unsuspiciously looking code, the wit statement can bite you, especially if you need to do refactoring and (because of that) introduce two names in the same scope.
Or in Paul‘s words:
Whilst upgrading the code to remove the Containers unit (its not supported on NextGen platforms, so I have to make things work with Generics.Collections instead, (bye bye D7 support for this code) and refactor a couple stupidities in my original design (they always creep in, don’t they) I ended up with two class members of the same name. The with block then looked OK but I was in fact not access the member I thought I was.
–jeroen
via: Paul Foster – Google+ – WITH IS EVIL! God damn it, I know it makes code easier to….
Filed under: Delphi, Delphi 1, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Pascal, Software Development, With statement
