On 17/07/18 06:16, Sven Barth via fpc-pascal wrote:
> Am 16.07.2018 um 23:14 schrieb R0b0t1:
>> On Mon, Jul 16, 2018 at 3:28 PM, Sven Barth via fpc-pascal 
>> <fpc-pascal@lists.freepascal.org> wrote:
>>> Am 16.07.2018 um 19:55 schrieb R0b0t1:
>>>> 
>>>>> - Try except finally blocks
>>>> I can support this one, I am surprised it is not already
>>>> supported. Wasn't this mentioned in another recent thread as
>>>> existing? Does it exist in at least Delphi mode?
>>> 
>>> This is not supported and the last time it was discussed here on
>>> the mailing lists it was shot down (though I can't find the
>>> thread currently...). Also why should it exist in Delphi mode
>>> when Delphi does not support it? (Yes, there are some features
>>> that work in Delphi mode that Delphi doesn't support, but in
>>> generic the purpose of mode Delphi is to support Delphi code)
>> From my searching it is in (newer?) Delphi. I can't admit to being
>> a huge fan of "finally" (I don't typically use it myself) but I am 
>> interested in why it is not supported.
> 
> At least Delphi Tokyo (10.2) does not support it.
> 
> If I remember the discussion correctly it came to light that some
> users would need "try … finally … except … end" while others would
> need "try … except … finally … end" and even some "try … finally …
> except … finally … end" or the like. With differences in opinion like
> this the idea was dropped, cause this flexibility exists already,
> namely by using separate blocks.
> 
> Regards, Sven 

I just had an idea come to my head - what if Lazarus would handle
the tiers of try for us ? Maybe it should be a feature of the code editor,
to convert

try
  try
    try
      code block 1;
    except
      code block 2;
    end;
  finally
    code block 3;
  end;
except
  code block 4;
end;

into 

try
  code block 1;
except
  code block 2; 
finally
  code block 3;
except
  code block 4
end;

and variations thereof; Then no compiler changes are necessary.

Lazarus already has the 'collapsible code blocks', and this is not much
different. I'll post this idea to Lazarus list.

cheers,
el es

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to