On Oct 30, 2011, at 3:36 AM, David Bruant wrote:

>> ...
> I wonder if the "only one semicolon" obsession is really worth it. Consider:
> -----
> const className = superClass <| function(/*constructor parameters */) {
>        //constructor body
>        super.constructor(/*arguments to super constructor */);
>        this.{
>         //per instance property definitions
>        };
>    };
> 
> className.prototype.{
>    // prototype properties
> };
> 
> // and if really necessary:
> /*className.{
>    // "constructor properties"
> };*/
> -----
> 
> As far as I'm concern, this is declarative enough:
> 1) <| provides the proper "super" (why the ".constructor"?) within the
> constructor body

In general, it is necessary to know at runtime what property name you are doing 
a super look up for. the name can be either implicit or explicit but it has to 
come from somewhere and generally JS functions don't always have intrinsic 
names. Also there are some issues relating to super references to getter/setter 
properties that make the explicit name nice.  Also, sometimes the method you 
want to super invoke is the name same name as the current method (for example, 
see 
https://github.com/allenwb/ESnext-experiments/blob/master/ST80collections-exp1.js#L419
 ).  We may be able to work out the details so we can leave out the property 
name if it is the same as the current method name, but for now I always 
explicitly include the name.



_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to