[Lazarus] Collapsible try...finally...except...end blocks idea

el_es el.es.cr at gmail.com
Tue Jul 17 10:34:39 CEST 2018


Hi,

this idea may need further refining, but it may be easier to handle 
in Lazarus source editor, than in the compiler, where it was 
originally posted.

In short, to have the nested try...finally/except...end; blocks display
in a single tier flatter manner, like

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

display in Lazarus like

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

with similar handling like the collapsible code blocks (e.g. a [+] or [-] on the gutter next to all the try's,
depending on what the default setting is, to display or not to display nested try blocks)
and handling of more 'sophisticated' nests like try...except...finally...except...end; 

(that means, in raw source code, this still will display like nested try blocks, not flat,
and as such be fed into the compiler).

This being handled in Lazarus would mean, that it would work in ANY compiler mode selected
(regardless if it's Delphi or not) and the benefits of flatter display of the code blocks 
would really show (like making it harder to enter code blocks where they normally don't go in such constructs,
and helping to catch errors made like that - e.g. if someone consciously needed to put code in places it
does not normally go, collapsing the construct would not work). 

It was met with resistance in the FPC mailing lists, and then it was dropped there; 
I can't say I don't agree with /some/ of their arguments actually.

Hope this would actually make more sense here :) as a coding tool.

Kind Regards

 el es



More information about the Lazarus mailing list