[e-lang] Bug?: escape-catch doesn't work at all
Mark S. Miller
markm at cs.jhu.edu
Tue Mar 27 11:29:48 CDT 2007
Kevin Reid wrote:
> ? escape e { e(1) } catch v { println(`caught $v`) }
> # value: 1
>
> Tested with E-on-Java 0.9.1b, 0.8.37d, and 0.8.35f.
>
> Is this a bug, or am I confused about how escape-catch works?
It is a bug, but not where expected. The interpretation of an EscapeExpr works
fine. The bug is in the source-to-source optimization performed by
BindFramesVisitor#visitEscapeExpr. This optimization properly optimizes
escape e { e(1) }
first to
escape e { 1 }
and then to
1
However, it was also optimizing
escape e { e(1) } catch v { println(`caught $v`) }
to
escape e { 1 } catch v { println(`caught $v`) }
which is wrong. It's now fixed (though not yet committed or released):
? escape e { e(1) } catch v { println(`caught $v`) }
# stdout: caught 1
#
Thanks for catching this!
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
More information about the e-lang
mailing list