Re: [fpc-pascal] Finally, exceptions and so on.

2015-05-14 Thread Mark Morgan Lloyd
Ewald wrote: On 05/14/2015 04:17 PM, Mark Morgan Lloyd wrote: So in effect, both an exit and a raise first execute the innermost finally, then look for procedure end or exception block repeating as necessary. Yes. These are the only cases where syntax needs to be unwound in this way. Well

Re: [fpc-pascal] Finally, exceptions and so on.

2015-05-14 Thread Ewald
On 05/14/2015 04:17 PM, Mark Morgan Lloyd wrote: > > So in effect, both an exit and a raise first execute the innermost > finally, then look for procedure end or exception block repeating as > necessary. Yes. > These are the only cases where syntax needs to be unwound in this way. > Well... Ther

Re: [fpc-pascal] Finally, exceptions and so on.

2015-05-14 Thread Mark Morgan Lloyd
Ewald wrote: On 05/14/2015 12:08 PM, Mark Morgan Lloyd wrote: Is there a single place in the documentation where this sort of behaviour is described and prioritised, Your first fragment is documented on http://www.freepascal.org/docs-html/ref/refse103.html At the bottom of that page: `Note tha

Re: [fpc-pascal] Finally, exceptions and so on.

2015-05-14 Thread Mark Morgan Lloyd
Jonas Maebe wrote: On 14/05/15 13:18, Mark Morgan Lloyd wrote: Except that- as I understand it- when the reference count is decremented to oblivion, it will be destroyed by "magic" code in the context of the block it was created in. At which point exactly they will be destroyed is an implement

Re: [fpc-pascal] Finally, exceptions and so on.

2015-05-14 Thread Jonas Maebe
On 14/05/15 13:18, Mark Morgan Lloyd wrote: > Except that- as I understand it- when the reference count is decremented > to oblivion, it will be destroyed by "magic" code in the context of the > block it was created in. At which point exactly they will be destroyed is an implementation detail that

Re: [fpc-pascal] Finally, exceptions and so on.

2015-05-14 Thread Mark Morgan Lloyd
Michael Van Canneyt wrote: On Thu, 14 May 2015, Mark Morgan Lloyd wrote: Starting off with this fragment begin // Start of procedure/function try ... if something then exit; ... finally ... end end; My understanding is that exit "magically" transfers control into the fina

Re: [fpc-pascal] Finally, exceptions and so on.

2015-05-14 Thread Ewald
On 05/14/2015 12:08 PM, Mark Morgan Lloyd wrote: > > Is there a single place in the documentation where this sort of > behaviour is described and prioritised, Your first fragment is documented on http://www.freepascal.org/docs-html/ref/refse103.html At the bottom of that page: `Note that an Exit s

Re: [fpc-pascal] Finally, exceptions and so on.

2015-05-14 Thread Michael Van Canneyt
On Thu, 14 May 2015, Mark Morgan Lloyd wrote: Starting off with this fragment begin // Start of procedure/function try ... if something then exit; ... finally ... end end; My understanding is that exit "magically" transfers control into the finally block before exiting t

Re: [fpc-pascal] Finally, exceptions and so on.

2015-05-14 Thread Graeme Geldenhuys
On 2015-05-14 11:08, Mark Morgan Lloyd wrote: > control doesn't go via the except block. > > Is there a single place in the documentation where this sort of That is expected behaviour. The exit statement doesn't cause an exception, so why would it go to the except code block? try..except docume

[fpc-pascal] Finally, exceptions and so on.

2015-05-14 Thread Mark Morgan Lloyd
Starting off with this fragment begin // Start of procedure/function try ... if something then exit; ... finally ... end end; My understanding is that exit "magically" transfers control into the finally block before exiting the procedure. However to state the obviou