[Pythonmac-SIG] a word of warning for pyobjc users

Ronald Oussoren ronaldoussoren at mac.com
Thu Feb 24 10:31:53 CET 2011


On 24 Feb, 2011, at 10:16, has wrote:

> 
> 
>> The BridgeSupport project is a mess, the specification is too lax to be useful.
> 
> Not the first time I've heard this criticism, but there are enough
> bridge and runtime developers around these days that they ought to be
> able to pull together some improvements. I know with OSS it's common
> for everyone to do their own thing, but a coherent group effort might
> register better on Apple's radar when they're deciding what's worth
> their support.

I've tried to work with Laurent to get something usefull going, but in the end this didn't work out. One example is the 'b' type string that is used for 'BOOL' in bridgesupport files: this got through several rounds of review without anyone noticing that  "sizeof(bool) == sizeof(BOOL)" is not always true (IIRC sizeof(bool) is 4 on PPC32).

> 
> 
>>> I would suggest dropping a note to Laurent Sansonetti (BridgeSupport +
>>> MacRuby lead) and other bridge & runtime devs
>> 
>> Ruby seems to be affected as well (although I'm not sure if I use the right syntax).
> 
> RubyCocoa and/or MacRuby? RubyCocoa uses the same method name swizzle
> as PyObjC, minus the trailing underscore, e.g.
> 
> 	[obj foo: x bar: y] -> obj.foo_bar(x, y).
> 	
> MacRuby uses heavier syntactic sugar to make positional args look like
> keyword args, e.g.
> 
> 	[obj foo: x bar: y] -> obj.foo(x, bar: y)

Method definitions aren't even relevant yet in my experiments, I've defined a subclass of NSObject and that wasn't seen by the IB component in Xcode.

class MyController < OSX:NSObject
    attr_writer :button
    def clicked(sender)
        puts "Button clicked!"
    end
end

> 
> 
>>>> What other options are there? Specify your GUI by hand?
>>> 
>>> Is it just the Read/Write Class Files functionality that's affected,
>>> or has Xcode 4 also lost the ability to specify IB classes manually?
>>> (IB 2 was good at this; IB 3 not so good but I think it was still
>>> possible.)
>> 
>> I haven't found a way to do "Read Class Files", probably because IB is now part of the Xcode IDE and no longer a standalone program (which means IB immediately knows when files are added or updated).
> 
> So can you still define class structures manually? Or is that gone too?

This seems to be gone too.  That's not unsuprising because the IB component hooks directly into the editor which in turn uses clang to have an up-to-date semantic model of the code you type (as long as it's (Objective-)C related.

> 
> 
>> There are probably good technical reasons why it is no longer easy to support scripting languages in IB, but the new behavior sucks nonetheless.
> 
> I doubt there's a good technical reason;

The "good" reason is probably that Xcode has an internal semantic model of the code using the clang project and adding support for scripting languages to that is relatively hard because there are not off-the-shelve components they could use for that.    That's a lame reason for completely dropping the support they had in Xcode3, but is understandable.

> 
> 
> Again, I'd recommend you have a pow-wow with all the other bridge and
> runtime developers, as you're the folks who are best able to describe
> the problem in both technical and practical terms and rally your user
> bases in concerted protest.

I'm not very interested in doing that as I hardly have any time to work on pyobjc as it is and I'd prefer to spend that on moving the project forward rather than trying to move a big corporation. Unless a lot of users start complaining (or a number of very large customers) this likely will have minimal priority within Apple.

Ronald



More information about the Pythonmac-SIG mailing list