Kona [[Getter]] and [[Setter]] descriptions

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Sun Nov 16 19:32:30 PST 2008


Peter Michaux wrote:
> On Sun, Nov 16, 2008 at 10:11 AM, Allen Wirfs-Brock
> <Allen.Wirfs-Brock at microsoft.com>
> 
>>  [[Getter]]  A zero-argument function that is called to return the property value each time the property read.
>>
>>  [[Setter]]  A one-argument function that is called with the assigned value each time the property is assigned. The effect of a property's [[Setter]] function may but it not required to have an effect on the value returned by subsequent calls to the property's [[Getter]] function.
> 
> These descriptions are going back towards the idea of "state" and a
> connection between getting and setting. I don't think that is
> necessary even though that is the motivation for their existence.
> Getting and setting are two totally disjoint operations unless a
> particular object is implemented so they are connected.

Yes. How about this:

  [[Getter]]  A zero-argument function that is called each time the
              property is read (via a [[Get]] operation), to return the
              result of the read.

  [[Setter]]  A one-argument function that is called with the written
              value each time the property is written (via a
              [[ThrowablePut]] operation).

The references to [[Get]] and [[ThrowablePut]] are needed because it is
possible for host objects to override any of the internal methods in such
a way that [[Getter]] and [[Setter]] are not used, even when there is a
property read (call to GetValue) or write (call to PutValue).

-- 
David-Sarah Hopwood


More information about the Es-discuss mailing list