On Nov 16, 2011, at 11:27 PM, Mark S. Miller wrote:

> On Wed, Nov 16, 2011 at 11:24 PM, David Herman <dher...@mozilla.com> wrote:
>    obj with { foo: 12 } with { bar: 13 } with { baz: 17 }
> 
> I don't get it yet. What do you mean by "dynamically extending prototype 
> chains"? What does the above expression do and evaluate to?

My first answer was glib, sorry. I'm proposing `with' as a replacement syntax 
for <|. So the above expression evaluates to the same as

    obj <| { foo: 12 } <| { bar: 13 } <| { baz: 17 }

which in turn, if I've got this right, would be equivalent to

    Object.create(Object.create(Object.create(obj, { foo: { value: 12,
                                                            enumerable: true,
                                                            configurable: true,
                                                            writable: true } }),
                                { bar: { value: 13,
                                         enumerable: true,
                                         configurable: true,
                                         writable: true } }),
                  { baz: { value: 17,
                           enumerable: true,
                           configurable: true,
                           writable: true } })

since in this example I only used the object literal variant. (The function, 
array, etc variants do things that Object.create can't do.)

Dave

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

Reply via email to