All of the really useful things I have learned in life haven't needed explaining. I've seen it, understood how it works and immediately seen how to make it work for me.

That just isn't happening for me with these new language "advances".

I could just be getting old (still some way off 40 yet though, so I hope not), but then again it could just be that the need for change for changes sake has finally outstripped any real need for change.

I hope you can show me how this stuff is useful, if only so that I can pretend I saw it all along and was just waiting for everyone else to catch up.

Why this construct is named anonymous "method" … since all the demos so far shows anonymous "functions" or "procedures" …. A method related to an object instance … so there is also a real anomymous "method" construct like the one below supported ?

Thank you for working on real language enhancements to Delphi! Also, please tell about them and give as more ideas and real-world examples as you can, because it is actually sells upcoming version of Delphi. As you may remember how linq and closures were discussed for C# and you know how it attracts new users.

It would be very interesting to hear about multithreading and closures and about new generics collections and closures, especially is there something like:

El Cy - it's just a name; don't read too much into it. In the end, however, the thing does actually turn into a method, on a class you can't see.

"anonListener" - (1) existing events are all method pointers, however a new type kind, method references, are needed to refer to anonymous methods because of state capture. Method references are reference counted, while method pointers aren't. Basically, without either GC or breaking lots of user code, we can't change events to be method references and be assigned anonymous procedures. So in short, no. (2) If OnClick had been a method reference, this would have been fine. (3) There is a basic level of interop support, but until lambdas get into C++ there won't be first-class level support.

m.Th - depends on the current time at the time of the call to Call / it's call to aProc.

Edit.Text guy: yes, it's possible to use Edit.Text, but be aware that a binary compare will want something like function(const left, right: string): Integer, rather than a boolean, because it needs an ordering relation. STL? There are new generic collections coming in Tiburon, but not at the depth or breadth of the STL. One step at a time!

Sorry about mistakes in previous post, of course it needs to be a comparator, not just equality check.

As to the Edit.Text - how it will be handled internally? As I understand you, when you use local variable X, then it is actually moved into the compiler-generated class, but if I reference Edit.Text, would you move Edit somewhere? And if not, how it all would be handled?

When parameters get captured, rather than deleting the original (which would make no sense), instead the parameter's value is copied into the activation record's field of the same type, and all subsequent references to the parameter are replaced with a reference to the field. The end semantics are the same, since you cannot access the original parameter, so changes to the parameter value are still shared etc.

Re 'yield', aka iterators, not for Delphi 2009, no - but much of the groundwork has been done in the compiler, and they should be easily addable at some point in the future.

Q6 - since you discussed about a new type (method reference) there is any way (RTTI ?) to use this support outside the closure construct. I mean for regular methods in already defined objects, can we get a method reference by a method name+parameters type (similar to what how Java 7 will introduce the closure+method handles - see Neal Gafter + John Rose)

Q7 - There is any support for currying into the new closure construct ?

Q1, Q2 - 'method references', the new unified method reference syntax, can refer to (1) anonymous methods, (2) global routines, (3) instance methods, (4) class methods, (5) pointers to all of the above. The only thing it can't refer to is local routines, and that should change post-Delphi 2009.

Q3 - RTTI - method references are interfaces undernead the hood. If METHODINFO is on, then the Invoke method will get RTTI; I might consider forcing this on for all method references.

Q6 - other uses of method references - method references are just interfaces. Technically, you can write a class that implements a method reference.

Q7 - currying - nothing built in, but with some suitably written generic method reference types, you can write your own currying routine. It won't be doing partial application underneath the hood like a functional language though, so you won't get other benefits like extra optimization that a functional compiler could do.

Procedural type is pointer to code.Method type is also pointer to code, but provides additional context - object instance.Anonymous method is another method type with a different context, something like local nested function type, on a wish list for about a decade:http://cc.codegear.com/Item.aspx?id=16841