On Oct 11, 2009, at 12:23 PM, memo...@googlemail.com wrote:

Currently I do use such kind of prototypes:

person = new function(name) {
 this.name = name;
}
person.prototype = new function() {
 /* Private */
 var id;

 /* Public */
 this.name = "";
 this.age = 0;
 this.location = "US";
}

This sketch could use a function-valued property of this to use the private id member, for motivation.


The problem is I won't be able to use getter and setter when the new
Ecmascript arrives.

Sorry, I don't know what you mean. What in ES5 prevents you from using which getter or setter syntax?

/be

But if I switch to object definitions for
prototype I won't be able to use private attributes anymore.
I propose to allow

person.prototype = {
 /* private */
 var id,

 /* public */
 name: "",
 age: 0,
location: "US"
}
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

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

Reply via email to