Classes as Sugar -- old threads revisited
Mark S. Miller
erights at google.com
Tue May 26 18:17:25 PDT 2009
On Tue, May 26, 2009 at 3:08 PM, P T Withington <ptw at pobox.com> wrote:
> These two are reversed, aren't they? The const should have the getter
> rather than the value?
>
>
> On 2009-03-30, at 22:41EDT, Mark S. Miller wrote:
>
> pubInstVar: {get: Object.freeze(function{return pubInstVar;}),
>> enumerable: true},
>> pubInstConst: {value: pubInstConst,
>> enumerable: true}
>>
>
No, it's correct as is. With an initialized const variable, its value can't
change, so we can just present the value directly as the value of a frozen
data property. A let variable, on the other hand, can continue to change.
Thus, in order for the property to continue to present the variable's
current value we need a getter.
--
Cheers,
--MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090526/24eb0db6/attachment.html>
More information about the es-discuss
mailing list