WITH is also usefull to initialize records

with rec do begin
  field1 := 1;
  field2 := 2;
  field3 := 3;
  field4 := 4;
  // and so on
end;

rather than c'sh style:

rec.field1 := 1;
rec.field2 := 2;
rec.field3 := 3;
rec.field4 := 4;


I also like to use with structure in bigger 'if' statement: with rec do if
(field1 = 0) and (field2 <> field3) or (field4 <> 0) then {...};

instead of: if (rec.field1 = 0) and (rec.field2 <> rec.field3) or
(rec.field4 <> 0) then {...};

though, i don't like usinng nested withs, or with for multiple records (with
rec1, rec2 do). It can make like easier, but it can also bring some bug in
the code :)

Anyway. All libs are written, using old-style syntax. So is it realyl
necessary, to add these new syntax changes to FPC? may be it's better to
clean then bugs first, and start changing syntax after that? Besides, these
changes are designed for .NET IDE, the code that would use new delphi syntax
would not be used with FPC, anyway.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to