On Apr 24, 2012, at 1:40 PM, David Herman wrote:
> On Apr 24, 2012, at 10:03 AM, Tab Atkins Jr. wrote:
>
>> There doesn't seem to be a need there for thin-arrow (dynamic this)
>> functions.
>>
>> (Edit: Oh, I see, leaning on the completion value of thin-arrow
>> functions here lets you shave a few characters off. The readability
>> loss of mixing the two syntaxes doesn't seem worthwhile, though.)
>
> Lets you eliminate "{" and "}" and "return", but requires additional ":" and
> "->". Net savings of 3 characters. But more than that, eliminating "return"
> lets you write methods in a functional style without needing the explicit
> control flow operator.
>
I believe that we could grammatically use ArrowBody as the body of concise
methods in object literals and classes. In that case, Dave's example could be
expressed as:
box = {
_value: 0,
unbox() ()-> this._value,
setbox(v) this._value = v
}
It could also be used as the body of getter/setters
val = {
_value: 0,
get value() this._value,
set value(v) this._value = v
}
Allen_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss