Arrow binding

Tab Atkins Jr. jackalmage at gmail.com
Tue Apr 24 09:33:27 PDT 2012


On Mon, Apr 23, 2012 at 3:36 PM, David Herman <dherman at mozilla.com> wrote:
> I'm much more sympathetic to the idea of having *two* shorter-function syntaxes, one optimized for methods and one optimized for non-method functions. I understand the concern about bloat, but to me it addresses the reality of different contexts in programming, e.g.:
>
>    a.map(x => x + 1)
>
> vs
>
>    box = {
>        _value: 0,
>        get: () -> this._value,
>        set(v) { this._value = v }
>    }

I don't understand this example.  What is "set(v) {...}"?  It's not a
setter, because it's not associated with a property name.  Assuming
you meant "set value(v) {...}", why not just use an ordinary getter as
well?

~TJ


More information about the es-discuss mailing list