On Thu, Nov 6, 2008 at 16:41, Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: > > The following code is just confusing as hell... > > with b: Button := new Button do > with c: Color := b.BackColor do begin > ... > b.Text := 'Hello World'; > self.Text := c.ToString; > ... > end; > end; >
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. Another common usage would be: with p := MyForm.Canvas.ClipRect do Draw(p.Right - p.Left, p); I.e. referring to object itself inside the 'with' statement. Now it requires a temporary variable. Note that I would prefer abbreviated form without explicit type. Full syntax has IMO too little advantage over the temporary. -- Alexander S. Klenin Insight Experts Ltd. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel