Swift: Offer a default-implementation of the equatable-operator for structs/classes
| Originator: | raise.rescue | ||
| Number: | rdar://18706601 | Date Originated: | 20-Oct-2014 01:23 PM |
| Status: | Duplicate of 15202393 | Resolved: | |
| Product: | Developer Tools | Product Version: | |
| Classification: | Reproducible: |
Summary:
Writing a struct / class like
struct A: Equatable {
var x: Int
var y: String
}
requires now to implement the ==-operator to conform to equatable. This is boilerplate-code that could be avoided. It would be way more convenient and also improve the readability if there would be something like
default ==
so that the struct/class in the end looks like
struct A: Equatable {
var x: Int
var y: String
default ==
}
This would combine the convenience of implicit compiler-generated operators like in C++ and the error-prevention of unwanted implicit auto-magic-functions by having the programmer to specify it explicitly.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!