[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug?



> However the catcher procedure is *not* protected by $&noreturn, and
> so something is returned as the value of the catcher -- and hence of
> the while construct.

Yep.  That's the problem.  Thanks for the diagnosis -- I spent about
twenty minutes looking at it last night without realizing what the
problem is.

> Maybe the protection of $&noreturn should be extended to all lexically
> enclosed procedures.  Or, maybe that doesn't make any sense.

That would be difficult to do.

I would argue that catch should call the catching function with
$&noreturn.  

Line 62 of prim-ctl.c

  list = eval(mklist(lp->term, e), NULL, evalflags);

could probably be changed to

  list = eval(mklist(mkterm("$&noreturn", NULL), mklist(lp->term, e)),
	      NULL, evalflags);

This does fix the problem, but I don't know whether it introduces any
bugs.

> Apparently, the following slightly more obfuscated version of while fixes
> the problem.

Clever.  Looks good to me, pending a fix in $&catch, as above.