ToModule and new Module

Sam Tobin-Hochstadt samth at cs.indiana.edu
Wed Sep 11 07:32:25 PDT 2013


On Wed, Sep 11, 2013 at 10:28 AM, Erik Arvidsson
<erik.arvidsson at gmail.com> wrote:
> What does the following do?
>
> var x = 1;
> var m = new Module({
>   get x() {
>     return x;
>   }
> });
> print(m.x);
> x++;
> print(m.x);  // ???
>
> Does ToModule do a [[Get]] or does it keep the accessor?

[[ToModule]] does a [[Get], so both of those lines print 1.

> What about setters? Does it keep identity of the getter function?

Sam


More information about the es-discuss mailing list