Re: try command error codes, where documented?

Liste des GroupesRevenir à cl tcl 
Sujet : Re: try command error codes, where documented?
De : clt.to.davebr (at) *nospam* dfgh.net
Groupes : comp.lang.tcl
Date : 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




Date Sujet#  Auteur
16 Aug 24 * try command error codes, where documented?7et99
17 Aug 24 `* Re: try command error codes, where documented?6greg
17 Aug 24  `* Re: try command error codes, where documented?5et99
19 Aug 24   `* Re: try command error codes, where documented?4Harald Oehlmann
21 Aug 24    `* Re: try command error codes, where documented?3et99
21 Aug 24     `* Re: try command error codes, where documented?2clt.to.davebr
22 Aug 24      `- Re: try command error codes, where documented?1et99

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal