Resource Block from do() { } to try() { }
Mark Mahieu
markmahieu at googlemail.com
Wed Sep 2 16:19:43 PDT 2009
On 2 Sep 2009, at 19:46, Joshua Bloch wrote:
> On Wed, Sep 2, 2009 at 6:11 AM, serge Boulay
> <serge_boulay at hotmail.com>wrote:
>
>>
>> What was the reason the resource block changed from the keyword
>> “do” to the
>> keyword “try”.
>
>
> It feels more like a try-catch ("attempt this computation, then do
> cleanup")
> than a loop ("keep doing this until some condition occurs").
Personally, I never confused the 'do' variant with a 'do...while',
but having experimented with both I think you're right that 'try' is
the superior option if you're going to stick with one of those two;
it conveys to the reader that the code contained within may
'fail' (but be automagically cleaned-up).
>
> Is it possibly more confusing using the “try” keyword since you
> can attach
>> a catch and finally clause to the block.
>
>
> We didn't have to permit this, but found it to be useful in practice.
>
Definitely.
>
> Josh
>
Cheers,
Mark
More information about the coin-dev
mailing list