with

David Herman dherman at mozilla.com
Thu Nov 17 05:13:05 PST 2011


On Nov 17, 2011, at 12:10 AM, Russell Leggett wrote:

>> since in this example I only used the object literal variant. (The function, array, etc variants do things that Object.create can't do.)
> 
> I think this is ultimately the downfall of 'with' as a complete replacement for <| or extends. It works pretty well on objects but no others.
> 
>    SomeFunc with function(){...}
> 
> Does not read nearly as well.

Interesting. I don't think it reads badly, but I can see it not being as intuitive as the object literal form. But lots of operators would look confusing if you didn't know what they mean (e.g., || or && or ^ or %). Once you know that `with` simply means prototype extension, I don't think it reads that badly. Subjective, I guess.

Dave



More information about the es-discuss mailing list