Re: [Pyobjc-dev] In and out of NSData
Brought to you by:
ronaldoussoren
From: Jack J. <Jac...@or...> - 2003-01-08 23:03:33
|
On woensdag, jan 8, 2003, at 23:06 Europe/Amsterdam, Ronald Oussoren wrote: >> But: why would going CF->NS->CF change the type of the object? > It wouldn't, but given the automatic translation from CF to NS (NOT > using the pyobjc_CFtoNS function) the following code would have > unexpected results: > > input = CF.CFMutableData(...) > arr = Foundation.NSMutableArray.arrayWithArray([data]) > output = arr[0] > > At this point 'output is not input', the do not even have the same > type(). Converting it back to CF would of course recover an object of > the same type as 'input'. I don't think this is too much of a problem. And there are already similar problems with Unicode vs. strings (try to get unicode data back where an NSString is returned:-). I think I would like the bridging to be done one-way, i.e. if something wants an NSArray and the argument isn't an NSArray it should try coercing the argument to an NSArray. One of the things that could be coerced is CF.CFArray. I think that for going the other way (from NS to CF) manual conversion is probably good enough initially. -- - Jack Jansen <Jac...@or...> http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - |