Concerning internalObjectID...
Peter Hosey
boredzo at adium.im
Tue Aug 16 00:29:50 UTC 2011
On Aug 15, 2011, at 15:05:56, Evan Schoenberg wrote:
> Yeah, it's weird that IRC has no truly consistent identifier for a contact but rather relies on the nick...
There are a couple of options, each with its own problem.
username at hostname is not changeable except by disconnection and reconnection, but multiple connections to the server can have the same u at h (with different nicknames).
nickname!username at hostname is unique, but can be changed at will.
> Maybe this would be a good case for a variable to do key-value-observer notifications on (rather than making up a brand new notification name)?
It might be worth making some kind of augmented dictionary that can automate this:
- Adding an object is done not with `setObject:forKey:`, but with `addObject:`, as with a set.
- The dictionary gets the object's `internalObjectID` (or whatever; this could even be set by the object by having it implement a property that returns the correct KVC key) and stores the object under that key.
- The dictionary also observes the object's `internalObjectID`, reassociating the object automatically when the ID changes.
- When the object is removed (with `removeObject:`), the dictionary stops observing the `internalObjectID`, gets it one last time, and removes it with `removeObjectForKey:`.
More information about the devel
mailing list