On Fri, Nov 6, 2015 at 1:42 PM, Michael Van Canneyt <mich...@freepascal.org> wrote: > > > On Fri, 6 Nov 2015, Martin Schreiber wrote: > >> On Friday 06 November 2015 17:20:24 Ondrej Pokorny wrote: >>> >>> >>> Nevertheless I am of the opinion that WITH is evil and should be removed >>> from the IDE/LCL code (unless only identifiers from within the with >>> scope are used; but even then they could be removed...). >> >> >> Or implement a safe "with" in Free Pascal without waiting until it is >> enforced >> by Delphi compatibility... > > > Ehm. How can "with" ever be safe ? > > Don't get me wrong: > > I use it abundantly. If I have QMYQueryObjectWithAVeryLongName then being > able to write > > With QMYQueryObjectWithAVeryLongName do > try > // Really nice code > finally > Close; > end; > > is really good (tm). > > NOT being able to use with would seriously impede on the readability of my > code. > > Add this to the observation that the lazarus team demands 'clear' variable > names, > and does not like/accept i,m,f,p,q or whatever as variable names, and using > "with" becomes very attractive indeed... > > Michael.
I hate "with" with passion because maintaining code written using it (by other people ;-) ) is very often a living hell. I, for one, always use local variables in that case, but I'd really really love to be able to declare an alias for "with" expression, no matter how many people say it's unpascalish... WRT a "safe with", well, the compiler could continue the identifier search as if it didn't find in the With expression and then generate an error or warning... -Flávio -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus