On 06.11.2015 17:42, Michael Van Canneyt wrote:
Ehm. How can "with" ever be safe ?

You can make sure that if some property is ADDED into the with scope, it doesn't break anything by explicitely using Self (or the unit name or whatever):

procedure TForm1.DoMySize;
begin
  //...
  with MyRect do
    Self.Width := Right - Left;
end;

But you cannot do anything if a property is REMOVED (e.g. Right in this case)...

So yes, let's not use with :)

+ I don't use with in my code any more. I confess that in the beginning I did use it, but decided to ignore the with statement at all. There is no problem with long variable names at all. There are CodeTools :)

Ondrej

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to