Allen Wirfs-Brock wrote:
(Yet Another Wacky Syntax Idea)

Here is a relatively common coding pattern:

var a;
var obj = {
    get a() {return a},
    set a(v) {a=v}
};

And why not this (specific to object literals, but they are primary concern):

let obj = {
    let a, // could be 'let a: 0,' to have initial value
    get a() { return a; }
    set a(v) { a=v; }
}

(read the inner 'let' as 'local' if it feels better)

Herby
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to