pyobjc / Doc / architecture.txt

The branch 'pyobjc-ancient' does not exist.
PyObjC Architecture

:authors: Ronald Oussoren


XXX: This documentent is outdated and incomplete.

This document gives a (brief) description of how the PyObjC package is 

Objective-C classes and objects

Objective-C classes are represented directly as python classes. This allows
us to implement subclassing of Objective-C classes with the full power that
new-style classes provide.

There is one problem with this though, PyTypeObject does not have space to
store additional information, and is a variable-sized object. This means that
subclasses of PyType_Type cannot add instance variables. We solve this by
storing the additional information in a dictionary indexed by the PyTypeObjects
that represent Objective-C classes.

Objective-C objects are represented by proxy objects that are instances of
the classes described above.

TODO: work out how we'll implement subclasses objects and describe here.

Methods and instance variables

Methods and instance variables are represented as 'descriptor' objects that
are attributes of the PyTypeObject describing a class. This way it is possible
to use the normal python introspection mechanisms to explore an objective-C

There is also a mechanism to call methods that are not part of the advertised
interface of a class. This is needed to support classes like NSProxy that 
forward method invocations to other objects.