[fpc-devel] Class extension
Matt Emson
memson.lists at googlemail.com
Thu May 20 15:14:04 CEST 2010
Jonas Maebe wrote:
> Having implemented support for Objective-C/Pascal categories in the
> compiler, I don't think that this concept can be translated to the
> (Delphi-compatible) Object Pascal model/implementation. It only works
> in Objective-C/Pascal because there all dispatching is based on the
> name of the method/selector (instead of based on VMT offsets or static
> binding).
I figured it would be pretty difficult to implement. It's definitely a
nice feature though. Maybe as it matures, it might be possible to
migrate and refactor?
> It may be doable with a separate class hierarchy (like
> TInterfacedObject for COM) and compiler/RTL magic (that would probably
> duplicate large parts of the Objective-C run time's functionality to
> get everything running at a reasonable speed), but in that case it
> might be more worthwhile to add support for GNUStep and extend the
> Objective-Pascal support to all platforms (since it wouldn't work with
> the regular Object Pascal classes in the RTL anyway). Objective-Pascal
> and Object Pascal can be mixed in the same file, so you can use
> delegation and other ways to bridge the two kinds of classes.
I wonder how easy it would be to do something with the Cocotron runtime?
It is geared to being compiled on Mac, but uses a MINGW based cross
compiler to target Windows and also compiles to target LINUX and BSD.
The compiled library binaries should be movable to Windows at least. It
also uses a more Cocoa like runtime mechanism than the GNUStep one. I
don't remember all the technicalities, but there is a difference that
was fairly important. That's probably a little vague, but I have a head
cold and feel a bit groggy today ;-)
Food for thought.
M
More information about the fpc-devel
mailing list