Arrow binding

Rick Waldron waldron.rick at gmail.com
Tue Apr 24 10:06:55 PDT 2012


On Tue, Apr 24, 2012 at 1:03 PM, Tab Atkins Jr. <jackalmage at gmail.com>wrote:

> On Tue, Apr 24, 2012 at 9:51 AM, Rick Waldron <waldron.rick at gmail.com>
> wrote:
> > When I read this, I assumed it was a reference to
> > this:
> http://wiki.ecmascript.org/doku.php?id=harmony:object_literals#object_literal_property_shorthands
> >
> > Which would produce a method named "set" on "box"
> >
> >> box.set(42)
> >> box.get()
> >
> > 42
> >
> >
> > The example is easily confused.
>
> Ah, that makes sense.  Okay.
>
> In that case, I don't see why one wouldn't just use the same syntax
> for both methods:
>
> let box = {
>  _value: 0,
>  get() { return this._value; },
>  set(v) { this._value = v; }
> };
>
> There doesn't seem to be a need there for thin-arrow (dynamic this)
> functions.
>

I think the colon was just a typo

Rick

 [snip]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120424/61b34876/attachment.html>


More information about the es-discuss mailing list