-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
NSKeyValueObserving: Implement setKeys:triggerChangeNotificationsForDependentKey:
#489
base: master
Are you sure you want to change the base?
Conversation
Implements the setKeys:triggerChangeNotificationsForDependentKey: class method. Please do not use it. It is fundamentally broken, and requires the object's meta class to hold additional state. Keys from this class method are the last resort when retrieving dependencies via keyPathsForValuesAffectingValueForKey:. This aligns with the implementation in Foundation.
It would be good to create a conditional configuration flag for disabling all deprecated (possibly performance degrading) APIs. I'll make some benchmarks, as |
That would be great. |
@rfm could you take a look at it? :D |
Arghy, I though't I'd reviewed this and that it had been committed weeks ago ... this means I've just made a buggy release of base with the implementation missing, so I need to make a bugfix release. |
I think what's needed is to back-out the last three commits, and then (if, and only if, the alternative is fully working), mark |
I'm wondering why we need another flag for this. We already have a flag to use the old implementation of KVO. |
I don't approve of that approach though: the correct way to deal with a structural problem is to change the code that depends on it (so it doesn't depend on it any more), deprecate it, and remove it either completely or by disabling at runtime. We have a standard mechanism for the case where we want to keep stuff in the codebase for OSX compatibility even though we think it's bad: the GSMacOSXCompatible user default, which can be tested (so efficiently that it imposes no significant runtime overhead) with GSPrivateDefaultsFlag(GSMacOSXCompatible). |
You could check out the commit before the additional changes (I guess 2060863) and merge that as a quick fix. |
Good point, I will do that.
…
On 17 Feb 2025 at 07:49, Frederik Seiffert ***@***.***> wrote:
>
>
> However, this branch now has additional changes we don't want in the release :-(
>
>
You could check out the commit before the additional changes (I guess 2060863) and merge that as a quick fix.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
triplef left a comment (gnustep/libs-base#489)
>
>
> However, this branch now has additional changes we don't want in the release :-(
>
>
You could check out the commit before the additional changes (I guess 2060863) and merge that as a quick fix.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
This pull request implements the deprecated class method
setKeys:triggerChangeNotificationsForDependentKey:
for creating dependencies in KVO.It is fundamentally broken as it is tied to the meta class, and subclassing it will break dependencies added in the superclass. Additionally, it requires the object's meta class to hold additional state.
As described in keypathsforvaluesaffectingvaluef#discussion which is the replacement for the now deprecated
setKeys:triggerChangeNotificationsForDependentKey:
:This implementation is consistent with the one in Foundation.
However, it seems like the old GCC KVO implementation is not. Precidence of the newer APIs, and internal caching of values is broken. I've marked all new tests as hopeful, but we should definitely fix that.