[swift-evolution] [Review] SE-0153: Compensate for the inconsistency of @NSCopying's behaviour

Xiaodi Wu xiaodi.wu at gmail.com
Fri Feb 17 19:05:49 CST 2017


>
>
>    - What is your evaluation of the proposal?
>
> This document seems to propose two contradictory alternative solutions; I
assume the goal is that the core team will choose one of two. I'm not sure
that either is an improvement over the status quo, for reasons I outline
below.


>
>    - Is the problem being addressed significant enough to warrant a
>    change to Swift?
>
> I agree that the current situation is problematic because of
inconsistency, but I think both proposed solutions are more problematic
because of more inconsistency.


>
>    - Does this proposal fit well with the feel and direction of Swift?
>
> On the one hand, I can agree that `@NSCopying` not being respected in
`init()` can be confusing. However, as was pointed out during the initial
pitch, this is consistent with other behaviors. For example, `didSet` is
not called from `init()` either, and there are good reasons for this. If
the proposal for custom behaviors were to come back into consideration, I
would assume that none of those behaviors could be triggered from `init()`
either.

A person who is new to Swift would continue to be confused if `@NSCopying`
had magic but `didSet` and other behaviors did not. A person who has
studied Swift and internalized the reasoning behind this initially tricky
situation might rightly expect that _all_ behaviors, including
`@NSCopying`, are ignored during `init`.

The proposal seems to prioritize new users migrating from Obj-C, who are
unfamiliar with Swift idioms, over Swift users who are right to expect some
internal consistency in the language. While supporting both groups is
important, I'm not sure it's appropriate to increase inconsistency within
Swift itself to help with migration from Obj-C.


>
>    - If you have used other languages or libraries with a similar
>    feature, how do you feel that this proposal compares to those?
>
> N/A.


>
>    - How much effort did you put into your review? A glance, a quick
>    reading, or an in-depth study?
>
> A quick reading.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170217/008c9259/attachment.html>


More information about the swift-evolution mailing list