On May 26, 2016, at 3:08 AM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:
>> Omission of fields from generated computations >> >> Should it be possible to easily omit certain properties from automatically >> generated equality tests or hash value computation? This could be valuable, >> for example, if a property is merely used as an internal cache and does not >> actually contribute to the "value" of the instance. Under the rules above, >> if this cached value was equatable, a user would have to override == and >> hashValue and provide their own implementations to ignore it. If there is >> significant evidence that this pattern is common and useful, we could >> consider adding a custom attribute, such as @transient, that would omit the >> property from the generated computations. > > A word of warning: an earlier proposal on memberwise initializers ran aground > because it tried to annotate properties to tell the compiler which ones > should be included in the generated initializer. It was ultimately judged too > complex a solution for the specialized problem space it was trying to tackle. > Can't fathom how one would not see the difference in complexity between the initializer proposals (untainable as they were proposed) and how simple it is to discriminate during generation of identity. Not to mention the other reasons why initializer generation could be turned down. > In other words, Keep It Simple, Stupid. > <https://en.wikipedia.org/wiki/KISS_principle> > > -- > Brent Royal-Gordon > Architechies > > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution