[fpc-pascal] The reason why linus torvalds hate-pascal

Andreas Berger Andreas at TheBergerClan.org
Sun Apr 20 19:18:44 CEST 2008


mm wrote:
> Zaher Dirkey a écrit :
>> I hate exit when i try to improve a procedure
>>
>>  some code
>> if (b) then
>> exit;
>>  some code
>>
>> for long procedures i cant notice exit here and add some resource or 
>> memory uses
>>
>> AnObject := TAnObject.Create;
>> try
>>
>>  some code
>>
>>  if (b) then
>>    exit;
>>
>>  some code
>>
>> finally
>>   AnObject.Free;
>> end;
>>
>> Now Exit leave the procedure without freeing "AnObject".
>> We need a new Exit keyword to jump to Finally section (I do not think
>> Abort is useful here).
>
> But AnObject is freed. If ever Exit had the behaviour you describe, we
> would have a big problem.
>
True, the object is freed and the procedure exited. Now it would be nice 
to jump to the finally clause and continue in the procedure. Sigh, 
wishfull thinking.

Andreas




More information about the fpc-pascal mailing list