[Pyobjc-dev] Re: [Pythonmac-SIG] pyobjc / cocoa

bbum@mac.com bbum@mac.com
Wed, 16 Oct 2002 11:43:38 -0400


A brief followup to my previous email:

     Doing such a mapping is ultimately a Very Bad Idea.

	While it makes reading PyObjC code easier from the perspective of a 
Python programmer, it seriously hampers the efforts of a programmer 
coming to the environment from an ObjC background.

     Making messaging across the bridge transparent is paramount.  
Making it syntactically transparent will cause problems both in 
maintenance and in coding efficiency.

     The Java bridge should not be used as a model of "how to do things 
right".  It is a painful, painful thing to use.

     As well, the pure Java version of Foundation, EO, and WebObjects 
provide a great deal of evidence that trying to map the Objective-C 
syntax into a Java or Python-like (because, in reality, Java's and 
Python's method invocation syntax is fairly identical) leads to a lot 
of confusion.   Even to this day, developers that have spent years 
working against the pure Java version of Foundation hesitate for a 
second when dealing with methods like setObjectForKey() -- some of the 
longer methods are even worse.

     As ugly as it is, there is a hell of a lot of value in preserving 
the ObjC method naming semantics on the Python side of the bridge.

     We have been down this path before -- in the ObjC [WebScript and 
its "new style" syntax] realm, in the Java realm with the bridge and 
pure Java implementations of Foundation, etc., and in the Python realm 
(this discussion has come up in the context of PyObjC on a regular 
basis since the project's inception so many years ago.

     b.bum


On Wednesday, October 16, 2002, at 11:25 AM, Jack Jansen wrote:
> On Wednesday, October 16, 2002, at 04:49 , Ronald Oussoren wrote:
>> To reply to myself...
>>
>> Another mapping scheme would be to just drop the colons and translate 
>> the character just beyond colons to uppercase. This would make the 
>> python methodnames more pleasant, although still long and 'foreign 
>> looking':
>>
>> 	[obj setObject:value forKey:key] -> obj.setObjectForKey(value, key)
>
> I think the bottom line is: which method makes it easiest to write 
> Python code given Apple's documentation? I must say I haven't looked 
> at the Java Cocoa documentation (actually, I tend to read the ObjC 
> header files mostly) but if that is good then I think we should stick 
> with the Java names. If it isn't good (or nonexistent:-) then an 
> algorithmic name translation scheme is probably best.
>
> Something else that might be worthwhile is a helper command that 
> translates ObjC calls to Python. You would then copy [obj setObject: 
> value forKey: key], paste it in your Python script (where it will stay 
> selected) and select the "ObjC methodcall to Python" command to turn 
> it into obj.setObjectForKey(value, key). The only question is how we 
> could get this into Project Builder (into the Python IDE would be 
> easy).
> --
> - Jack Jansen        <Jack.Jansen@oratrix.com>        
> http://www.cwi.nl/~jack -
> - If I can't dance I don't want to be part of your revolution -- Emma 
> Goldman -
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: viaVerio will pay you up to
> $1,000 for every account that you consolidate with us.
> http://ad.doubleclick.net/clk;4749864;7604308;v?
> http://www.viaverio.com/consolidator/osdn.cfm
> _______________________________________________
> Pyobjc-dev mailing list
> Pyobjc-dev@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
>
b.bum
Are you laughing?
	... they are.