Re: David’s ProxyMap

Axel Rauschmayer axel at rauschma.de
Thu Oct 25 03:33:44 PDT 2012


> I agree there are use cases for distinguishing method invocations from property accesses (remote method calls are one of them -- you'd want to distinguish between doing an HTTP GET vs POST). But the new API hasn't changed the balance for or against an "invoke" trap. Recall that one of the reasons was that an "invoke" trap would lead to invoke-only methods, which goes against functional programming patterns in Javascript (e.g. people expect array.map(obj.method) to work)

Ah, that makes sense. I previously didn’t understand why invoke-only methods were a problem.

In some ways, invoke-only methods do reflect how things actually work with proxies: they are easier to implement if you don’t have to reify a method. With the current API, you are forced to reify.

Doesn’t the currying incur a cost (for the frequent use case of “virtual methods”)? Could that cost (performance + elegance) be avoided in some other manner?

Axel

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121025/955e7499/attachment.html>


More information about the es-discuss mailing list