[fpc-devel] Closures

Blaise Thorn me at blaise.ru
Mon Jan 16 15:11:20 CET 2012

On 16.01.2012 16:05, Sven Barth wrote:

> How firm are you with the implementation of generics inside the compiler?

Totally blank. Since you are the person who has been working on that area most recently, I would actually appreciate if you could compile a document (on the wiki?) outlining the internal workings of generics in FPC; for the current documentation, I understand, is quite lacking. On my part, I already have a document (only in Russian, though) describing the implementation of closures; I will translate and publish it after my initial commits (which I expect to be on We/Th this week).

> If you're not that firm it might be better if I implement generic procedures/methods first and then you can build on that (as that should hopefully be reusable by you).

For now, I don't reckon that any ordering is required.
Note that the only thing in closures that can have type parameters is method references
	type M<T> = reference to procedure(const X: T);
which are converted, internally, into generic interfaces.
A nameless routine (closure) can only /refer/ to generic type parameters of the enclosing routine/class, and I hope that making it generic-aware/generic-safe wouldn't be that hard.


More information about the fpc-devel mailing list