On Thu, Nov 12, 2009 at 11:18 AM, Orestis Markou <or...@or...> wrote:
>
> On 12 Nov 2009, at 11:59, Ronald Oussoren wrote:
>
> > What really annoys me though is that I haven't been able to find a way to
> get clear integration of Cocoa and Python without changing the Python
> syntax, and without using manual translation of method names (as was used by
> the Java-Cocoa bridge).
>
> I've given some thought to that in the past, and of course I know it comes
> up on the list every couple of months.
>
> I think an important step is maintaing the order of the **kwargs
> dictionary:
>
> def set(self, **kwargs):
> # construct method name from kwargs
> # extract positional args from kwargs
> objc.dispatch(methodname, args)
>
>
> foo.set(Value=1, forKey='a')
> foo.set(forKey='a', Value=1)
>
> If those calls could be differentiated in the body of 'set', would it not
> help? Some cases could be ambiguous, but in that case a warning could be
> emitted and the current convention could be used instead.
>
Mapping python-style named parameters to objective-c message sending would
probably incur quite a bit of overhead, and the end result, in my mind, ends
up being not so readable either.
Best regards,
Anders
|