[fpc-pascal] Re: Fpc Access Violation if AppConfigDir doesn't exist.

Lukasz Sokol el.es.cr at gmail.com
Wed Feb 13 12:33:47 CET 2013


On 13/02/2013 11:01, Sven Barth wrote:
> On 13.02.2013 10:11, Lukasz Sokol wrote:
[...]
>> To developers: How would a generalized/packed construct like
>> 
>> try [code block] finally [code block] except [code block] end;
> 
> or what about
> 
> try [code block] except [code block] finally [code block] end;
> 
> In any case the semantics need to be defined correctly. E.g. in the
> first case what happens if an exception is raised inside the
> "finally" block? In the second case what happens if an exception is
> raised inside the "except" block? Do they work like nested "try try
> except end finally end" or "try try finally end except end" blocks or
> do they have the same rules?

I'd imagine it should work exactly like try try ... finally ... end; except ... end;
so if exception happens in 'finally' block, 'except' is executed,
if no exception happens anywhere, only 'finally' happens.

> 
> Keep this FAQ entry in mind when suggesting features:
> http://www.freepascal.org/faq.var#extensionselect
> 
Nice, thanks!

> (Note: I personally would have nothing against such a feature, but
> the details need to be defined!)
> 
>> 
>> (in other words: a try-*-end construct where * can be 'finally', or
>> 'except', or BOTH.)
>> 
>> fit into Pascal philosophy? Advantages is mainly: - one less indent
>> level ('oh, I need try-except around all THAT, bugger.') to care
>> about; (yeah, even with all the good tools to manage the code, it
>> stings, that the two have to be separately declared and one needs
>> to remember that...)
>> 
>> Would it be very complicated?
> 
> I don't know how complicated it would be (we now also need to take
> into account Win64 SEH and possibly in the future also Win32 and
> WinCE SEH), but it should at least be doable...
> 
> Regards, Sven
> 

I was imagining something in or just before the parser, detecting the 'composite'
construct and 'mechanically' (string for string even) substituting it for two-level 
traditional, putting the 3 code blocks into the proper places. 
No ifs, no buts, same semantics, just flattened. 
Write once, compile everywhere ;) Unfortunately I don't have 
enough compiler knowledge to even imagine where this could be happening. 

That would have all cases covered then...?

Lukasz




More information about the fpc-pascal mailing list