On Oct 4, 2011, at 12:44 AM, Brendan Eich wrote:

> On Oct 4, 2011, at 5:43 AM, Russell Leggett wrote:
> 
>> I don't want to be pushy, so this is the last time that I'll mention
>> it, but if we can create something using the <| operator that can
>> basically do what has been discussed for the simplest class literal,
> 
> I think you're barking up several wrong trees. But yes, Allen proposed <| and 
> .{ to help make class-like syntax lighter-weight (if more punctuated), 
> without having real class syntax. Unfortunately any such poor-person's "class 
> unsyntax" will remain error prone (easy to leave out or misorder a 
> sub-expression) and slightly verbose (compared to just-so class syntax).
> 

Brendan,  It sounds like you may have missed this alternative from  the "Minor 
extension to Set Literal Prototype..." thread that eliminates the mis-ordered 
or left-out constructor clause problem.

> On Oct 2, 2011, at 12:52 PM, Allen Wirfs-Brock wrote:
>> 
> 
...
>   But, what if we allow:
>     propName.{ ...}
> to occur in a PropertyAssignment position of an object extension literal.  
> Then the pattern could be:
> 
> const ClassName = SuperClass <| function(/*constructor parameters */) {
>        //constructor body
>        super.constructor(/*arguments to super constructor */);
>        this.{
>            // per-instance properties
>        };
>    }.{       
>        prototype.{    //  <<<<< note . instead of :
>            // methods
>        },
>        // class (ie, constructor) properties
>    };
> 
> It's only a one character change but it eliminates the hazard that some 
> people are concerned about of leaving off the .constructor or 
> .constructor.{...} at the end of the pattern.  Also, I can imagine that 
> "recursive stache"  (hey, it's inevitable that "mustache" will get contracted 
> to "stache") would be useful in other situations. Personally, I find this new 
> pattern not quite as "pretty" than my original proposal (it's less symmetric/ 
> more irregular hence probably harder to learn and remember) but I'd still be 
> happy to use it.

> 

Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to