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

Mark S. Miller erights at google.com
Mon May 23 10:48:56 PDT 2011


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();
        //...
      }
    }

Your reply to Dave makes use of generative module functions. Yes, if we have
generative module functions then my objection disappears. Modules would then
also be generative.




>
> /Andreas
>
>
> > On May 20, 2011 7:58 AM, "Andreas Rossberg" <rossberg at google.com> wrote:
> >> On 19 May 2011 16:05, David Herman <dherman at mozilla.com> wrote:
> >>> Yes, we've talked about this. One of the issues I don't know how to
> >>> resolve is if we want to allow the specification of class properties
> aka
> >>> statics, then those need *not* to be in the scope of the constructor
> >>> arguments, which ends up with very strange scoping behavior:
> >>>
> >>>    var x = "outer"
> >>>    class C(x) {
> >>>        static foo = x // "outer" -- whoa!
> >>>    }
> >>>
> >>> I'm not 100% up on the current thinking of the group that's been
> working
> >>> on classes, and whether they are including statics in the design, but I
> >>> think they are.
> >>
> >> Oh, it wasn't clear to me that we really want to have static members.
> >> I may be biased here, but I always viewed static members as just a
> >> poor man's substitute for a proper module system. Fortunately, it
> >> looks like we will have a real one instead!
> >>
> >> To be honest, I'm a bit worried that there will be a _lot_ of semantic
> >> redundancy in the end. After adding modules + classes + static members
> >> (+ traits?), there would be at least three or four different,
> >> complicated constructs that evaluate to some kind of object, with
> >> significant functional overlap.
> >>
> >> Thanks,
> >> /Andreas
> >
>



-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110523/51309e9e/attachment.html>


More information about the es-discuss mailing list