[fpc-pascal] methods of an object to create others objects

Martin fpc at mfriebe.de
Wed Jul 7 15:34:22 CEST 2010


On 07/07/2010 14:25, Andrew Brunner wrote:
> On Wed, Jul 7, 2010 at 8:05 AM, Martin<fpc at mfriebe.de>  wrote:
>    
>> if " obj1.free; " crashes, then yes obj2 is not going to be released. But as
>> explained in this and my last mail: It should not be attempted to be
>> released.
>>
>>      
> Martin, I can't disagree more.  I find it completely ludicrous that if
> obj1.free raises an exception you should just trow the baby out with
> the bath water.  If Obj1.Free raised an exception because a disk drive
> was unmounted... Inspect the log... Handle the exception... And fix
> the problem.  Future instances will be handled and all is good.  It is
> my belief that the notion of skipping exception handling and
> restarting an application is very bad practice.
>    
Had you only read to the end of my mail..... You are deliberately 
ignoring part of what I wrote and the blame me for the remainder being 
incomplete?

I clearly stated that there are cases where "free" can raise a valid 
exception, and that the developper has to know this cases, and handle 
them (with nested try blocks).

But I also wrote that (for me) the rule is that most "free" are not 
expected to do so (that may of course be totally different in your code).

Martin



More information about the fpc-pascal mailing list