Am 02.08.2011 16:38, schrieb Max Vlasov:
Hi,Personally I stopped using 'with' keyword long time ago, but there are code fragments from the past and today I fixed a little bug showing again that it's a evil. TCanvas in lazarus has width and height properties while in Delphi it hasn't (at least some time ago). So the code below leads to different results in lazarus and Delphi, at least for design-time drawing. procedure TControlDescendant.Paint; begin with Canvas do begin Rectangle(0, 0, Width, Height); edn; end; So not only the 'with' context can silently change while the project is evolving, it can also change while it's being ported...
I personally consider "with" as a statement of the category "from great power comes great responsibility" and thus "handle with care". "absolute" is another example of such a construct (and I like to use it in event handlers that have "TObject" as sender ^^).
Regards, Sven -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
