LOL I don't think it is meant to be taken personally. There are some valid points here. As Neven and Andreas point out the extra Assign checks are unnecessary, slow things and in some situations may even reduce readability. For example in Peter Speden's example I wouldn't check whether the string lists are assigned, because in normal operation of the program they will be. If something weird happens and they aren't assigned the it will work fine anyway because Free handles it.
However if I have a situation where an object is created only if required and then freed later then I would usually put the "if Assigned(LThing) then ...". Basically I do this because it's quite likely that LThing won't be assigned and writing the code this way makes that obvious for the next poor sod who comes along to maintain the code. I guess it's because calling nil.Free, just like calling any object method with a nil object reference, seems a little naughty. It works if the method is written correctly but in general I regard it as bad practice. Healthy discussion I think we call it... the fight might start next ;-) David. > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Behalf Of Alistair George > Sent: Monday, 3 March 2003 1:01 PM > To: Multiple recipients of list delphi > Subject: Re[2]: [DUG]: Freeing Stringlists. > > > Hey, hey, I didnt want to start a fight here! > Al+ > > NM> assignment check for 'readability' you are essentially > advertising your > NM> ignorance of the language IMHO > > ------------------------------------------------------------------ > --------- > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
