[swift-evolution] Should we rename "class" when referring to protocol conformance?
Andrew Trick
atrick at apple.com
Sat May 7 19:07:22 CDT 2016
> On May 7, 2016, at 2:04 PM, Dave Abrahams <dabrahams at apple.com> wrote:
>
>> 2. Value types are not "pure" values if any part of the aggregate contains a
>> reference whose type does not have value semantics.
>
> Then Array<Int> is not a “pure” value (the buffer contained in an
> Array<Int> is a mutable reference type that on its own, definitely does
> *not* have value semantics). I don't think this is what you intend, and
> it indicates that you need to keep working on your definition.
It sounds like you’re changing the definition of value semantics to make it impossible to define PureValue. Does Array<T> have value semantics then only if T also has value semantics?
The claim has been made that Array always has value semantics, implying that the array value’s boundary ends at the boundary of it’s element values. That fact is what allows the compiler to ignore mutation of the buffer.
It's perfectly clear that Array<T> is a PureValue iff T is a PureValue. PureValue is nothing more than transitive value semantics.
At any rate, we could add a PureValue magic protocol, and it would have well-defined meaning. I'm not sure that it is worthwhile or even a good way to approach the problem. But we don't need to argue about the definition.
-Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160507/172138c0/attachment.html>
More information about the swift-evolution
mailing list