[Lazarus] 'with' is evil, isn't it?

Jürgen Hestermann juergen.hestermann at gmx.de
Thu Aug 4 07:24:21 CEST 2011


leledumbo schrieb:
>> I think a warning if the name inside of 'with' overrides a name from outer
>>     
> scope would be an acceptable compromise.
> I agree with this solution, it doesn't change the syntax, yet it gives
> better chance to spot wrong scope of identifier which could happen during
> porting or upgrade.
>
>   
We have the same issue here as it exists for for-variables: If you 
forgot to declare your local for-variable it helps to get warned if the 
variable name exists as a global or parent function variable too. So a 
warning that a reference within a with statement resolves to a variable 
outside the with statement would help finding bugs.





More information about the Lazarus mailing list