Ye olde arguments argument (was: Topic list - pending changes and issues for the ES3.1 spec)

Brendan Eich brendan at mozilla.org
Mon Sep 15 16:29:18 PDT 2008


On Sep 16, 2008, at 12:21 AM, liorean wrote:

> 2008/9/16 William Edney <bedney at technicalpursuit.com>:
>> Could I do an assignment of the handler? Sure, but syntactically
>> suboptimal, IMHO.
>
> Once JScript has fixed the function name scope bug, you could use
>
>     myElem.addEventListener(
>         'click',
>         function f(){
>             doSomething();
>             this.removeEventListener(
>                 'click',
>                 f,
>                 false);},
>         false);

Or to work around the JScript bug:

     (function () {
         function f(){
             doSomething();
             this.removeEventListener('click', f, false);
         }
         myElem.addEventListener('click', f, false);
     })();

Lots of workarounds, none free, but still possibly tolerable or even  
not measurable in performance and memory costs.

In case anyone missed it,

http://wiki.ecmascript.org/doku.php?id=proposals:stack_inspection

Ignore the type parameter and annotations, to see the essential  
proposal.

/be


More information about the Es-discuss mailing list