I noted some open issues on "Classes with Trait Composition"

Andreas Rossberg rossberg at google.com
Tue May 24 06:21:44 PDT 2011

On 23 May 2011 19:48, Mark S. Miller <erights at google.com> wrote:
> On Mon, May 23, 2011 at 7:22 AM, Andreas Rossberg <rossberg at google.com>
> wrote:
>> On 20 May 2011 15:42, Mark S. Miller <erights at google.com> wrote:
>> > Modules aren't generative.
>> If you mean that you cannot create several objects from them, then
>> yes, but see my reply to Dave.
>> However, I was primarily wondering about static members, which don't
>> provide any generativity in that sense either.
> Static members on classes are generative merely because classes are
> generative:
>     function makeFoo() {
>       return class Foo {
>         static x = Math.random();
>         //...
>       }
>     }

OK, now I see what you mean. However, I'd say that is not really a
difference between the semantics of modules vs static class members
per se, but simply a consequence of classes being first-class, while
modules are restricted to second-class status. That, in turn, is
merely a (well-advised) design choice of the current proposals, but
nothing inherent to either modules or classes.


More information about the es-discuss mailing list