Re: [Pyobjc-dev] Auto bridging instances by conversion
Brought to you by:
ronaldoussoren
From: Just v. R. <ju...@le...> - 2003-02-04 13:29:13
|
bb...@ma... wrote: > On Tuesday, Feb 4, 2003, at 04:01 US/Eastern, Just van Rossum wrote: > > Sure, eg. in Python this happens with exceptions. However we're not > > talking about arbitrary objects, but about real basic immutable > > types (strings and numbers). I claim that any code in which the id > > of an NSNumber or NSString is important is seriously broken. > > That claim is faulty. Uh, I didn't say such code didn't _exist_. > There are many situations where the type of the object is totally > irrelevant to the local implementation. That is, as far as the > implementation is concerned, everything is an (NSObject*) and the > only important piece of information is the id-- the self pointer-- of > that object. As Ronald indicated, this situation arises outside of > various random performance hacks-- NSMapTables and the underlying CF* > types are often used to map instances to other instances, regardless > of type, as a part of object graph maintenance. Can't find decent doco for NSMapTable, yet what I have found says it's not even a true object (it's not even an id); just an opaque struct with a functional interface. Where are the semantics of NSMapTable _visible_ when using Cocoa classes, and in what case would code actually break if we supply it with an NSNumber with a different id? I want things to be as convenient as possible in the usual case, I don't mind some odd surprises in extreme cases. NSMapTable seems sufficiently low level that I don't see how it can be relevant to Python code using Cocoa. > By assuming otherwise, the bridge will cause very subtle, but very > ugly, problems in many situations where the developer is going to be > mighty surprised that it didn't "just work". I don't believe your "many" qualifier here. A real example would be useful. > We already have that > situation with the string conversions that are happening now. Like where? (Apart from the NSMutableString conversion bug of course.) Just |