> On May 7, 2016, at 2:04 PM, Dave Abrahams <dabrah...@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
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to