[Grace-core] finally {return}

Kim Bruce kbbruce47 at gmail.com
Tue Jun 23 10:06:02 PDT 2015


For comparison, Java prints
x
y
2
but there is a warning in the code for foo that the finally block does not
complete normally.
The write-up on finally clauses is very complicated.  I suspect ours will
be as well.  I think the only reasonable choices are the Java one and
James' suggestion of throwing an exception because of multiple returns.  I
lean slightly toward the Java solution, but can live with either (I don't
think this reflects good coding style).

On Tue, Jun 23, 2015 at 3:09 AM James Noble <kjx at ecs.vuw.ac.nz> wrote:

>
> > On 23/06/2015, at 21:51pm, Michael Homer <Michael.Homer at ecs.vuw.ac.nz>
> wrote:
> >
> > Follow-up question: what should this code do?
>
> at a guess: raise an “you are attempting to return from a method
> invocation that has already returned” error
>
> same as this:
>
> var aBlock
>
> method setup {
>    aBlock:= { return 42 }
> }
>
> setup
>
> aBlock.apply
>
>
>
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailhost.cecs.pdx.edu/pipermail/grace-core/attachments/20150623/47ba567a/attachment.html>


More information about the Grace-core mailing list