JavaScript anonymous functions, weird or callbacks to the future?


This whole javascript anonymous function is just odd isn’t it?  Like that beautiful women who goes out with that guy who is uglier then even me.  But maybe not that strange.  Where did it come from.

Well as usual I checked with the Ecmascript standard 262 and searched for anonymous functions, nothing came up.  Does this mean that it shouldn’t be used?  No.

Then I begin to think about anonymous functions in C# and what they do.  Here is what one of the things that they can do: Call another function and then continue processing till that function completes it’s operation and passes pack information.

But now, the problem becomes this: How does the system know that the function is done, or what it promises to return.

More later on that.

 


Comments (4)

  1. Cheong says:

    Regarding callbacks, the only thing that I hope for is that javascript supports chained event handlers like it used to be in C#. When coding for webpages, lots of time I found that the newly registered event handler just overwritten the old one, so the page starts behave funny.

    Sometime I can go the jQuery way to create custom container object to hold the events, by that's just inconvenient.

  2. SoCal Sam says:

    Cheong00,

    Again, good feedback.  Fodder for a future blog.  JavaScript anonymous functions wrt to chain events.  Good.

    For readers who might not know this, Cheong is an MSP, which means that he is one of the respected Microsoft experts.  And I wish he would share his web site or blog with us. 🙂

    Sam

  3. Cheong says:

    Oh, I don't have blogs or personal website.

    I have had one during my school days, but I'm too lazy to bother update it often. 😛

    In these days I just wonder around the BBSs, forums and others' blogs to discover topics that catch my interest.

  4. SoCal Sam says:

    cheong00,

    You are always welcomed to make comments on my blog.  I really appreciate it.

    Sam