gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Key Value Observation is over reacting


From: Fred Kiefer
Subject: Re: Key Value Observation is over reacting
Date: Sun, 16 Dec 2007 10:02:22 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20070801)

Fred Kiefer wrote:
> Richard Frith-Macdonald wrote:
>> I have to leave soon (I'm away for the weeked to go to a christmas
>> party), so I've comitted the work I've done to svn.  I don't expect
>> anyone else will be using it so if I've broken KVO that should not cause
>> problems (I did make sure my changes compiled).
>>
>> Basically the idea was a rewrite so that we only override setters at the
>> point when we first add an observer for the corresponding key.  I hope
>> it works, but haven't had any time to test it at all (and I'd also like
>> to clean it up a bit and make sure it raises the same exceptions that
>> apple raises when there are errors).
>>
>> Anyway, if you can play with it and either fix any problems or email me
>> about them (and I'll try to deal with any issues on monday), I'd be
>> grateful.  Otherwise, just use the earlier version from svn.  Enjoy.
>>
> 
> As far as I was able to test your new implementation works. Great job!
> 
> The bad thing is that I am already stuck again. My code uses setKeys:
> triggerChangeNotificationsForDependentKey: and here the dependent key is
> one that doesn't even exists on the observed object. What the code needs
> to do to handle this is to add the setter override for all the keys that
> get mapped to the dependent key. I have a look if I am able to implement
> that on top of your new code. At a first glance it doesn't look to hard.
> 

It was fairly easy, but after fixing it the next problem popped up and
then the next and the next. But now I have the feeling the new KVO
implementation is working pretty well.
I removed the exception when there is no suitable setter method. After
all the observer may be interested in the underlying value, even if it
wont change over time. This is rather common for a multi leveled key
path. Here the first part may never change, still we need to set up an
observer for it.
It would be great if somebody with more experience in that area has a
second look on my changes.

Cheers,
Fred




reply via email to

[Prev in Thread] Current Thread [Next in Thread]