[swift-evolution] Proposals: (1) Forbidding custom `==` for value types, (2) `dispatch` keyword, (3) `default`-result for methods with `Self`, and (4) Poor-Mans-Existentials

Austin Zheng austinzheng at gmail.com
Mon Jul 18 14:43:48 CDT 2016

On Mon, Jul 18, 2016 at 12:28 PM, Johannes Neubauer via swift-evolution <
swift-evolution at swift.org> wrote:

> Dear Xiaodi,
> > Am 18.07.2016 um 20:55 schrieb Xiaodi Wu <xiaodi.wu at gmail.com>:
> >
> > As mentioned earlier, NaN != NaN, demonstrating that an Equatable
> instance that does not always equal itself is not "radical." Plainly, your
> proposal is unworkable.
> 1. this is a basic internal type, so it can have a special behavior, since
> it is a well-designed data type created by the language designers (since
> there is no need to bootstrap swift from the first bits this is OK).

The problem is that this is *exactly* how Swift works. There is nothing
special about e.g. Double except for the fact that it wraps a built-in type
and the implementation of its operations forward to built-in functions.
This is how all the stdlib types work. You can build your own refcounted
COW `Array` with exactly no additional compiler support from scratch, if
you want.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160718/d680fd84/attachment.html>

More information about the swift-evolution mailing list