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

Boian Mitov mitov at mitov.com
Thu Jul 17 10:01:58 CEST 2008


This is if you like the risk of using "with" ;-)
This works until somebody changes the FDayList[WeekDayNum].Rows[Timeslot] to 
contain CountSlots property, and all your code is broken ;-) .
If you want stable code, never use the "with" or else ... ;-)

  With best regards,
    Boian Mitov

--------------------------------------------------------------------
Mitov Software
http://www.mitov.com
--------------------------------------------------------------------


----- Original Message ----- 
From: "Jonas Maebe" <jonas.maebe at elis.ugent.be>
To: "FPC developers' list" <fpc-devel at lists.freepascal.org>
Sent: Thursday, July 17, 2008 12:15 AM
Subject: Re: [fpc-devel] C style operator doesn't work with properties in 
2.3.1



On 17 Jul 2008, at 09:09, Daniƫl Mantione wrote:

> Even shorter:
>
> with itm do
>  with FDayList[WeekDayNum].Rows[Timeslot] do
>    AvailableSlots:=AvailableSlots+CountSlots;

Even shorter:

with itm, FDayList[WeekDayNum].Rows[Timeslot] do
    AvailableSlots:=AvailableSlots+CountSlots;

But nested or combined with-statements can be dangerous in case there
are multiple fields with the same name in the different records/
classes/objects.


Jonas_______________________________________________
fpc-devel maillist  -  fpc-devel at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel 




More information about the fpc-devel mailing list