[fpc-devel] C style operator doesn't work with properties in 2.3.1

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Jul 17 09:38:44 CEST 2008


On Thu, Jul 17, 2008 at 9:09 AM, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
> Or
>
> with FDayList[itm.WeekDayNum].Rows[itm.Timeslot] do
>  AvailableSlots:= AvailableSlots+itm.CountSlots;


No that's one language construct I wish Object Pascal could do
without!  I personally hate the 'with' statement, and it's hard to
debug.

At least FPC with mode objfpc had the common sense NOT to allow the
following (which I believe is still allowed in Delphi).  Also tooltip
evaluation/debugging doesn't work with 'with' statements in Lazarus or
Delphi.


type
  MyClass = class(TObject)
  ...
  public
    property MyName: String .....
  end;

procedure MyClass.Foobar;
var
  MyName: string;
begin
  with self do
  begin
     MyName := 'hello';  // Are we using e local var MyName or MyClass.MyName??
  end;
end;



Regards,
 - Graeme -


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



More information about the fpc-devel mailing list