Expression closures - use-cases for shortcut lambda syntax (blocks)

Vassily Gavrilyak gavrilyak at
Sat Mar 17 13:46:37 PDT 2007

On 3/17/07, Bob Ippolito <bob at> wrote:
> > The signal/slot implementation in MochiKit is not at all superfluous.
> > More than one callback can be connected to a slot, and when connected
> > to DOM objects it presents a uniform event object regardless of the
> > underlying implementation.
> >
> > No needs for workarounds? Are you kidding? We are talking about web browsers.
I am not criticizing Mochikit, I like it. It covers many workarounds
for browsers.
What I am telling that it shouldn't be here, such framework is
possible to have in language directly and C# proves this.
About more then one callback - that's exactly why I used += and not just =.
Again, that is already solved in C#. And it should be as much simpler
in ES, otherwise people will just move to C# and use compilers to JS.

> Additionally the method names are used because it's shorthand for:
> function (object, method) { return function () { return
> object[method].apply(object, arguments); }; };
> Really...

That's I understand too, and used same approach in my code 2 years
ago. Then I moved to functions, because methods are not that really
needed. When I need to pass method to callback expecting function I do
just setCallback(obj.method.delegate(obj)). This way only one argument
(function) is needed in API, not two (object, method). Having 2
arguments complicates API, and built-in callbacks still provides one
argument only (like setTimeout or Array.sort), so for me
looks better to stay coherent with such callbacks.

Also there is no strings usage here, everything looks like it is "typed".

And direct call is still the best, especially with typed ES4.

> -bob
Regards, Vassily

More information about the Es4-discuss mailing list