>From section 8.6.1 [[Getter]] A method that to be called each time the property is read, to retrieve the current value of the property.
[[Setter]] A method to be called each time the property is assigned to, in order to define the current value of the property. The description of [[Getter]] seems reasonable. Even if the getter function returns a random number each time it is called, that random number can be considered "the current value of the property" when it is read. Given the language of the [[Getter]] description focusing on "the current value", the parallel language in the [[Setter]] description "in order to define the current value" may implies the value I set will be the value I retrieve when getting. That isn't the case as the getter may always return a constant number or random number unrelated to the value sent to the setter. I suppose you could justify that the language is ok with the following argument. Suppose a object "obj" has a property "prop" which is a named accessor property. Its getter returns a constant, and the setter just swallows its argument. // Start with "the current value" being 5 obj.prop // --> 5 Interpret "the current value" as 5 obj.prop = 1 // Interpret "the current value" as 1 obj.prop // --> 5 Interpret "the current value" as 5 So even though "the current value" of the property was 1 at the second step, it was never observable as 1. For this reason it seems like it requires a contrived interpretation of the [[Setter]] description to make the description work. There was never any state behind prop storing a 1 at any time. Sending 1 to the [[Setter]] never had any impact at all behind the scenes. Is there any need to discuss state at all when describing getters and setters? The motivation for getters and setters may have been to affect state, that isn't their only possible use. They are more generic than that. Would the following be sufficient? [[Getter]] A zero-argument method called each time the property is read. [[Setter]] A one-argument method called each time the property is assigned. Peter _______________________________________________ Es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

