[fpc-devel] Re: CodeGear abandons Delphi.NET

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Nov 6 14:48:18 CET 2008


On Thu, Nov 6, 2008 at 3:35 PM, Alexander Klenin <klenin at gmail.com> wrote:
>
> Maybe, but consider the alternative in today's FPC:
> with Button.Create do
>  with BackColor do begin
>    Text := 'Hello World';
>    Self.Text := ToString;
>  end;
>
> It is easy to miss which properties refer to which objects,
> and hard to read the code even if you manage to remember it correctly.


And a perfect example of why I DON'T user the 'with' statement!  Hard
to read, hard to understand and hard to debug (tooltip expressions
cannot evaluate it even in Delphi v7 at least).  :)

I feel strongly against the WITH statement as I do against the GOTO
statement.  The only time you will ever see me use the WITH statement
is in auto generate UI code as shown below:

  cbType := TfpgComboBox.Create(self);
  with cbType do
  begin
    Name := 'cbType';
    SetPosition(8, 24, 272, 22);
    FontDesc := '#List';
  end;



Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list