[fpc-pascal]Passing Methods as Callback Procedures?
Jonas Maebe
jonas at zeus.rug.ac.be
Wed Dec 18 13:20:45 CET 2002
On dinsdag, dec 17, 2002, at 19:00 Europe/Brussels, Judison wrote:
> I look at the sources, and, as you say that its in the docs, I look at
> tha docs too, but I don't find any ForEach...
> But a grep show me that you are using TCollection of Objects.pp... :)
> and I was looking at classes.pp ;)
>
> I don't know much about "objects".... :)
> there is no "of object" in objects.pp
The ForEach methods of objects.pp don't expect (and as such cannot work
with) methods as function parameters, they only work with *nested*
procedures. That the fact that you pass a pointer to a method (or a
non-nested procedure) to a ForEach method instead of a nested procedure
is wrong, cannot be detected by the compiler because the type of the
parameter of TCollection.ForEach is simply an untyped pointer (that's
the way it was defined by Borland). Besides, there is no way to specify
a procedure-variable type that only allows nested procedures.
Jonas
More information about the fpc-pascal
mailing list