Robert Downey
News
My Blog
About Me
My Thoughts
Resume
Code
Contact Me
Can Your Programming Language Do This? (Yes, it can!)
Joel Spolsky (who writes the fairly well known JoelOnSoftware.com blog) has written a fairly interesting post about anonymous methods and how useful they are. The language he uses to demonstrate this feature is JavaScript, and he asks the rhetorical question "Can Your Programming Language Do This?"

Yes, yes it can! Since version 2.0 of .NET, the CLR has fully supported anonymous methods.

In fact, in version 3.0 they will support anonymous types, partially in order to facilitate some great stuff like LINQ.

I've seen several people comment that delegates (or unmanaged function pointers) are functionally (no pun intended) equivalent to anonymous methods. This isn't really true.

Anonymous methods really shine exactly because you don't have to prototype the method first. Yes, you could do basically the same thing with delegates, but you would have to declare each of these delegates, create a method that matches the delegate signature, create a delegate instance, and finally pass that instance to the method in question.

digg story