On Thu, Apr 29, 2010 at 3:25 AM, Alex Russell <[email protected]> wrote:
> 3.) Syntax for bound function de-reference
>
> Many functions, both in the DOM and in the library, accept functions as
> arguments. ES5 provides a bind() method that can ease the use of these
> functions when the passed method comes from an object. This is, however,
> inconvenient. E.g.:
>
> node.addEventListener("click", obj.method.bind(obj, ...));
node.addEventListener("click", #(e){obj.method(e)});
> 1.) all de-references via bang from an object/function pair return the
> *same* function object (modulo #4).
> 2.) non-function objects de-referenced via bang are not mangled in any way
> (identical to dot-operator de-reference)
> 3.) there's no provision for binding arguments (curry)
> 4.) bang-bound functions are weakly referenced. If GC would otherwise
> remove a function object from memory, having previously bang-bound a
> function should not keep the function object alive
I'm not sure how you make 1 and 4 happen at the same time. (It also
sounds like you're saying that bang-bound functions weakly reference
their inner function, not that they are themselves weakly referenced.)
Mike
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss