[swift-evolution] [Pitch] Changing NSObject dispatch behavior
kevin at sb.org
Thu Dec 15 16:16:13 CST 2016
On Thu, Dec 15, 2016, at 12:51 PM, Michael Ilseman wrote:
>> On Dec 14, 2016, at 6:32 PM, Kevin Ballard via swift-evolution <swift-
>> evolution at swift.org> wrote:
>> I don't think we should ever make it possible to mark an entire class
>> as `dynamic`. This just reintroduces the Obj-C problem, where many
>> properties support KVO, but not all, and there's no indication on the
>> property itself as to whether it supports it.
> I’m not familiar enough with these kinds of bugs. Kevin, do you think
> the existing behavior aligns with or runs counter to safe-by-default?
The existing behavior is safe-by-default. You have to opt-in to a
property supporting KVO, and the opt-in nature of this means that the
property is self-documenting as to whether it supports KVO. Of course,
it's possible to write a `dynamic` property that actually doesn't do KVO
properly (e.g. because it's a computed property that uses another
backing property, and you modify the backing property directly), but
since 99.9% of `dynamic` properties are only dynamic in order to support
KVO, I have no concerns about someone writing a `dynamic` property that
doesn't actually do KVO properly.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution