Pre-Proposal: Linguistic support for locks

Peter Mount peter at retep.org.uk
Mon Mar 9 03:15:33 PDT 2009


Agreed. try's been mentioned in these threads mainly because of the scope of
ARM, but as we quite rightly move locks away from the ARM proposal then
protected makes more sense.

On Mon, Mar 9, 2009 at 10:05 AM, Reinier Zwitserloot <
reinier at zwitserloot.com> wrote:

> Ditto - try is the wrong keyword for this one. protected works great.
> Also gets rid of the 'you can add catch / finally blocks at the end
> for consistency' device, which really doesn't make too much sense for
> locks.
>
>  --Reinier Zwitserloot
> Like it? Tip it!
> http://tipit.to
>
>
>
> On Mar 9, 2009, at 00:56, Jesse Wilson wrote:
>
> > On Sun, Mar 8, 2009 at 11:20 AM, Joshua Bloch <jjb at google.com> wrote:
> >
> >>   try (<lock-expr>) {
> >>       <code>
> >>   }
> >
> >
> > try is definitely the wrong keyword here. Mostly because there's
> > already a
> > method Lock.tryLock() that is not at all related to this sweet sugar.
> >
> http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/locks/Lock.html#tryLock()<http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/locks/Lock.html#tryLock%28%29>
> >
> >  1. Use the protected keyword in place of try.
> >>
> >
> > This is fantastic. I especially like that proper Locks would become
> > just as
> > easy-to-use as the built-in monitor on Object.
> >
>
>
>


-- 
Peter Mount
e: peter at retep.org.uk
w: http://retep.org
Jabber/GTalk: peter at retep.org MSN: retep207 at hotmail.com



More information about the coin-dev mailing list