Sujet : Re: try command error codes, where documented?
De : clt.to.davebr (at) *nospam* dfgh.net
Groupes : comp.lang.tclDate : 21. Aug 2024, 06:08:02
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <99917242168821001@llp>
References : 1 2 3 4 5
This finally behavior I had not known. It also seems quite remarkable to me since ordinarily once a return statement is executed, the stack frame would be expected to be popped and so that variable f would no longer be accessible. Clearly try must be doing something special if it can execute code after a return command.
From the first paragraph of the try man page:
... if the finally clause is present, the script it includes will be run and the result of the handler (or the body if no handler matched) is allowed to continue to propogate.
The "result of the body" is the result from the try script, not the finally script.
I'm kind of amazed it works too, but it is very nice that it does. My most common use for try {...} finally {...} is to close a file regardless of any errors after reading and maybe processing the contents inside the try script.
daveb