On Nov 22, 2011, at 10:54 AM, Bob Nystrom wrote:

> 
> On Tue, Nov 22, 2011 at 10:41 AM, Brendan Eich <[email protected]> wrote:
> 
> Nothing there about arrays or regular expressions, and the function examples 
> do *not* show anything like
> 
>  superFun <| function (...) {...}
> 
> Instead of Ahem'ing, could you cite what you claim is a prior proposal with 
> specifics showing how it addresses object, array, regexp and function 
> [[Prototype]] presetting?
> 
> I'm guessing this been proposed before but I think you could handle all of 
> those except RegExp with syntax something like:
> 
> // object:
> { extends someObj, prop1: value, prop2: value }
> 
> // array:
> [ extends someObj, value1, value2 ]
> 
> // function declaration:
> function foo(arg) extends someObj { ... }
> 
> // function expression:
> function(arg) extends someObj { ... }
> 
> You could maybe cram it into RegExp with something like:
> 
> /pattern/ extends someObj;
> 
> I haven't been following the <| discussion closely (it seems like it's in 
> good hands and has lots of smart people poking at it) so forgive me if this 
> was proposed and rejected for valid reasons while I wasn't looking. :)

You (and others) are roughly working backwards along the path that ultimately 
led to the invention of <|.

Some of the concerns about the "embedded" approach:

You are introducing several syntactic forms that have to be learned an 
remembered  instead of just one.

Your examples are only consider examples where the "proto" value is a simple 
identifier reference:

function (arg) extends {extends Function.prototype, method1: function() {}, 
method2() {}} { ...}

contrast with
  Function.prototype <| {method1: function() {}, method2: function() {}} <| 
function (arg) {...}

To handle RegExps you have to introduce something that looks like an operator 
but is even more specialized than <|.

You can't handle numeric or string literals.  This may seem like a stretch, but 
consider:

    UTF16StringProto <| "a string containing UTF 16 surrogate pairs"

where  UTF16StringProto has versions of the string methods that understand how 
to treat surrogate pairs as logically single characters.

A pseudo binary operator like <| (whatever your preferred spelling) still seems 
to me like the most directly and least intrusive way to deal with all of these 
scenarios.

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

Reply via email to