Define static properties and prototype properties with the class syntax

Brendan Eich brendan at mozilla.org
Sun Dec 14 12:44:10 PST 2014


BTW the general idea goes back to Waldemar's ur-JS2/ES4:

"""
Annotated groups are useful to define several items without having to 
repeat attributes for each one. For example,

class foo {
   var z:Integer;
   public var a;
   private var a;
   private function f() {}
   private function g(x:Integer):Boolean {}
}

is equivalent to:

class foo {
   var z:Integer;
   public var a;
   private {
     var b;
     function f() {}
     function g(x:Integer):Boolean {}
   }
}

"""

from 
http://web.archive.org/web/20030216224101/http://www.mozilla.org/js/language/js20-2002-04/core/statements.html#directive-group.

/be


Andrea Giammarchi wrote:
> Will do soon
>
> Cheers
>
> On Sun, Dec 14, 2014 at 6:00 PM, Rick Waldron <waldron.rick at gmail.com 
> <mailto:waldron.rick at gmail.com>> wrote:
>
>
>
>     On Sun Dec 14 2014 at 10:40:53 AM Andrea Giammarchi
>     <andrea.giammarchi at gmail.com <mailto:andrea.giammarchi at gmail.com>>
>     wrote:
>
>         as side note, I wonder why static hasn't been considered
>         definable as group/object
>
>
>         ```js
>         class Foo {
>           static {
>             bar: 'bar',
>             get defaults() {
>               return {de:'faults'};
>             }
>           }
>         }
>         ```
>
>
>     I like that, can you write up a proposal?
>
>     Rick
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141214/b9593c43/attachment.html>


More information about the es-discuss mailing list