On 2018-07-20,
phil...@gmail.com <
phil...@gmail.com> wrote:
>
> Hi,
>
> We are noticing another change in the behavior of Tcl that I think traces
> back to changes in TIP90 in Tcl 8.5.
>
> We used to see an error thrown for a malformed return statement, but now,
> the malformed return is tolerated.
This is no longer an error. From TIP 90:
Specification
The return command shall have syntax:
return ?option value ...? ?result?
There can be any number of option value pairs, and any value at all is
acceptable for an option argument.
>
> In the below interpreter sessions, return_an_expr is defined as:
>
> proc return_an_expr {} {
> return expr { 1 / 1 }
> }
So in the above, expr is an option and { 1 / 1 } is its value.
8>< --------
and everything you are seeing is as expected. Instead of
> % catch return_an_expr
try
% catch return_an_expr resultvar optvar
and look at the value of optvar.
Eric
--
ms fnd in a lbry