[e-lang] Variations on When-Catch

Mark Miller markm at cs.jhu.edu
Tue Dec 21 11:54:53 EST 2004


Kevin Reid wrote:
> I think finally-in-when should not be deprecated. The finally clause 
> covers the same code that the catch clause does, and neither covers the 
> immediate expression since it *is* immediate. While this is potentially 
> confusing, it's far too useful to lose, in the cases where one needs it.
> 
> (There are six occurrences of when...finally in Den.)

Ok. And it's wonderful to be able to base the decision on actual experience. 
Thanks!


> One might think of it like this:
> 
> when (milesTraveled() // ksPerMile) -> done(ksTraveled) {
>                                            # do something with ksTraveled
>                                        } catch problem {
>                                            # handle problem
>                                        } finally {
>                                            # do regardless
>                                        }

I like that! Although it wastes too much horizontal space to ask people to 
actually write it this way, I think it's a great way to explain it.

MarcS, what do you think of using this layout when you first explain the 
when-catch in Walnut?

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

     Cheers,
     --MarkM



More information about the e-lang mailing list