[Pyobjc-dev] Re: [Pythonmac-SIG] pyobjc / cocoa
Bob Savage
bobsavage@mac.com
Wed, 16 Oct 2002 15:20:22 -0500
On Wednesday, October 16, 2002, at 01:54 PM, Seth Delackner wrote:
> On Wednesday, October 16, 2002, at 06:18 , Bob Savage wrote:
>
>> [obj message: arg1 withFoo: arg2];
>> [obj withFoo:arg2 message:arg1];
>>
>> Those are two different methods. This means that the Seth's system
>> would not work
> I may be wrong, but I disagree with your assessment. There is only a
> single mapping possible from my example (although now looking at it,
> my example had a typo). What I meant is:
>
> rt.call(obj, "message", arg1, "arg2name", arg2);
> # giving us the message name = "message:arg1name:arg2name"
>
> The method 'rt.call' would take arguments [0] object to receive the
> message, [1] first part of the message name, [2] . Each subsequent
> pair of arguments is interpreted as first the next chunk of the
> message name and then the next part of the message arguments.
>
> Where is the ambiguity?
Hopefully I am not misunderstanding you. If what you are saying is you
could take :
rt.call(obj, "message", arg1, "arg2name", arg2);
and have rt.call() concatenate the strings "message" and "arg2name"
(with a colon between) then converting that to the selector (like
method name for the runtime) "@sel(message: arg2name)" and then do a
call selector with arg1 and arg2, sure you can do that.
Here is where I see the ambiguity arising:
@sel is drawSelfAtPoint:withSize:color:
rt.call(obj, "drawSelfAtPoint", p, "color", c, "withSize", "s")
rt.call() concatenates the method name as "drawSelfAtPoint: color:
withSize:". Then the runtime sends a message to the object to perform
the selector "@sel (drawSelfAtPoint: color: withSize:)", and the object
says, it can't.
Am I understanding you correctly? Because, the way I see it, this is
likely to encourage runtime errors (unknown selector).
Bob