Arrow binding

Brendan Eich brendan at mozilla.org
Tue Apr 24 13:21:57 PDT 2012


Rick Waldron wrote:
> I think the colon was just a typo

Dave is not cc'ed and may have missed the responses going back to Tab's 
first one, but I think there was no typo. Dave's example:

     box = {
         _value: 0,
         get: () ->  this._value,
         set(v) { this._value = v }
     }


Yes, it's awkward as examples go because get and set are contextual 
keywords, but this shows them used as plain identifiers. This also shows 
-> as property value in an object literal (for property name 'get'), 
well as method definition shorthand (for 'set'), to contrast the two styles.

/be


More information about the es-discuss mailing list