[e-lang] Bug (0.8.26h): multiple-pattern catch expansion is incorrect

Mark S. Miller markm at caplet.com
Thu Apr 29 17:41:37 EDT 2004


At 02:23 PM 4/29/2004  Thursday, Kevin Reid wrote:

>? try { throw("oops") } catch ==1 {}
># problem: oops
>
>? try { throw("oops") } catch ==1 {} catch ==2 {}
># problem: no match: problem: oops
>
>The expansion for multiple-catch-clause try-catch does not follow the 
>semantics of the kernel try-catch when the pattern match fails - it creates 
>a new exception instead of simply passing on/rethrowing the unmatched one.

Good catch, so to speak. This is now bug
https://bugs.sieve.net/bugs/?func=detailbug&bug_id=125607&group_id=16380


>This will be important once E has a useful exception type system (which I am 
>working on a proposal for).

Looking forward to it!


>Possible solutions:
>
>1. Replace e`throw("no match: " + @x)` with e`throw($x)`, though there will 
>still be an extra throw() in the stack trace.
>
>2. Allow an arbitrary number of catch clauses in Kernel-E.
>
>3. Somehow make match failure of all of the individual patterns in the 
>expansion cause failure of the try-catch expression's pattern.
>
>4. Expand each catch clause into a nested try-catch.


#4 seems simplest to me. Do you see any problems with it?


-- 
Text by me above is hereby placed in the public domain

        Cheers,
        --MarkM



More information about the e-lang mailing list