Action proxies
Brendan Eich
brendan at mozilla.com
Mon Feb 4 13:38:31 PST 2013
David Bruant wrote:
> // notif proxies
> trap(...args){
> // pretrap code
> return () => {
> // post-trap code
> }
> }
>
> In the last snippet, the engine has to store the result of
> Reflect.trap(...args) internally, but that's not worse than storing it
> in a variable as it would currently be the case. I think that having
> this storage internal may even open the door to optimizations that
> would be harder if not impossible to achieve with current proxies.
Maybe, but this is irrelevant to the allocation of the arrow-function
closure.
> Thinking about it more, since the posttrap can't modify the return
> value, it can be seen like a "finally" block. So return-value related
> allocation characteristics of a notif proxy with a post trap are
> comparable to the allocation characteristics of:
>
> function f(){
> try{
> return 'https://www.youtube.com/watch?v=08WeoqWilRQ'
> }
> finally{
> console.log('finally')
> }
> }
No, that's not a closure. It's not free either, but there's no closure
allocation.
/be
More information about the es-discuss
mailing list