with

David Herman dherman at mozilla.com
Thu Nov 17 14:08:26 PST 2011


On Nov 17, 2011, at 1:30 PM, Brendan Eich wrote:

> If I have code of the kind Mike Samuel showed:
> 
> obj
> with ({ foo: 12 })
> {}
> 
> and I migrate directly into ES-whatever with 'with' as you propose (instead of <|), then I do not get an early error.

Understood.

>>> Also, using 'with' around object literals makes me want functional record update. IIRC we've talked about that before.
>> 
>> That's one of the things I like about `with` for this: prototype extension is already a great mechanism for functional update on objects.
> 
> Prototype extension or delegation is not the same as FRU at all -- the delegating object can shadow proto-properties,

That's precisely what makes it analogous to FRU. You functionally update (i.e., update without mutating) by shadowing.

> the chaining is observable many ways (methods on the prototype, not only reflection APIs), there are two objects not one.

Yes it's observable, but it's a very natural fit. It's how I do FRU today, using Object.create.

Dave

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111117/0aacc95b/attachment-0001.html>


More information about the es-discuss mailing list