Another argument against using maps is it can actually be pretty useful to
use the features that prototypal inheritance and the object model provides.
function Descriptor(configurable, enumerable){
this.configurable = configurable;
this.enumerable = enumerable;
}
Descriptor.prototype = {
configurable: undefined,
enumerable: undefined,
inerit: function inerit(){
return Object.create(this);
}
};
function DataDescriptor(value, writable, enumerable, configurable){
this.value = value;
this.writable = writable;
this.enumerable = enumerable;
this.configurable = configurable;
}
DataDescriptor.prototype = new Descriptor
DataDescriptor.prototype.value = undefined;
DataDescriptor.prototype.writable = undefined;
function AccessorDescriptor(get, set, enumerable, configurable){
this.get = get;
this.set = set;
this.enumerable = enumerable;
this.configurable = configurable;
}
AccessorDescriptor.prototype = new Descriptor;
AccessorDescriptor.prototype.get = undefined;
AccessorDescriptor.prototype.set = undefined;
function Value(value){
this.value = value;
}
Value.prototype = new DataDescriptor(undefined, true, true, true);
function HiddenValue(value){
this.value = value;
}
Value.prototype = new DataDescriptor(undefined, true, false, true);
function Accessor(get, set){
this.get = get;
this.set = set;
}
Accessor.prototype = new AccessorDescriptor(undefined, undefined, true,
true);
function Getter(get){
this.get = get;
}
Getter.prototype = new Accessor;
function Setter(set){
this.set = set;
}
Setter.prototype = new Accessor;
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss