with
David Herman
dherman at mozilla.com
Wed Nov 16 23:41:57 PST 2011
On Nov 16, 2011, at 11:27 PM, Mark S. Miller wrote:
> On Wed, Nov 16, 2011 at 11:24 PM, David Herman <dherman at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111116/e23c4f31/attachment.html>
More information about the es-discuss
mailing list