Re: ObjC interoperability

guido@CNRI.Reston.VA.US
Fri, 21 Apr 95 14:26:10 -0400

>Last november, Christian Brunschen (d89cb@efd.lth.se) sent a
>message on this list with a proposal about Python-ObjectiveC
>interoperability. I tried to contact him but with no luck. I looked
>in the FAQ, but there is no mention to this. News anybody?

Yes, there is news! I just spent the better part of yesterday morning
discussing an objc interface for Python with my co-workers Barry Warsaw
and Roger Masse (who both have NeXTSTEP systems on their desks).

An objc interface will be required by the project the three of us
are working on for the next year. I am planning to do one within
three months; right now it's all still in the very early design phases.

To give you a taste of our discussion: there would be two or three ways
of making the message call

[point moveTo: x by: y]

the most Python like way of doing this would be:

point.moveTo_by_(x, y)

a more generic way would be

import objc
point._message(objc.selector('moveTo:by:'), x, y)

yet another form this could take would be

point._call('moveTo:', x, 'by:', y)

There are still a lot of things to be worked out, e.g. what to do about
parameter types (is there a way to tell that the moveTo:by: message
takes integer arguments?), return value types (same thing really),
and how to access the NeXT standard library.

For the latter, we expect that you will be able to say

from objc import String
s = String.alloc().init() # s = [[String alloc] init];

for a few very common classes, and we expect to create an interface
to bundles so you can dynamically load any other classes you like.

And no, none of this exists in code, yet :-(

--Guido van Rossum <guido@CNRI.Reston.VA.US>
URL: http://www.cwi.nl/~guido/