<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 15, 2016, at 1:48 PM, Dave Abrahams &lt;<a href="mailto:dabrahams@apple.com" class="">dabrahams@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">on Mon May 09 2016, Matthew Johnson &lt;</span><a href="http://matthew-at-anandabits.com/" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">matthew-AT-anandabits.com</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&gt; wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class="">On May 8, 2016, at 1:51 AM, Dave Abrahams &lt;<a href="mailto:dabrahams@apple.com" class="">dabrahams@apple.com</a>&gt; wrote:<br class=""><br class=""><br class="">on Sat May 07 2016, Andrew Trick &lt;<a href="http://atrick-at-apple.com" class="">atrick-AT-apple.com</a>&gt; wrote:<br class=""><br class=""></blockquote><br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">&nbsp;&nbsp;On May 7, 2016, at 2:04 PM, Dave Abrahams &lt;<a href="mailto:dabrahams@apple.com" class="">dabrahams@apple.com</a>&gt; wrote:<br class=""><br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2. Value types are not "pure" values if any part of the aggregate<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;contains a<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reference whose type does not have value semantics.<span class="Apple-converted-space">&nbsp;</span><br class=""><br class="">&nbsp;&nbsp;Then Array&lt;Int&gt; is not a “pure” value (the buffer contained in an<br class="">&nbsp;&nbsp;Array&lt;Int&gt; is a mutable reference type that on its own, definitely does<br class="">&nbsp;&nbsp;*not* have value semantics). I don't think this is what you intend, and<br class="">&nbsp;&nbsp;it indicates that you need to keep working on your definition.<br class=""><br class="">It sounds like you’re changing the definition of value semantics to make it<br class="">impossible to define PureValue.<span class="Apple-converted-space">&nbsp;</span><br class=""></blockquote><br class="">Not on purpose.<br class=""><br class=""><blockquote type="cite" class="">Does Array&lt;T&gt; have value semantics then only if T also has value<br class="">semantics?<br class=""></blockquote><br class="">This is a great question; I had to rewrite my response four times.<br class=""><br class="">In my world, an Array&lt;T&gt; always has value semantics if you respect the<br class="">boundaries of element values as defined by ==. &nbsp;That means that if T is<br class="">a mutable reference type, you're not looking through references, because<br class="">== is equivalent to ===.<br class=""><br class="">Therefore, for almost any interesting SomeConstraint that doesn't refine<br class="">ValueSemantics, then<br class=""><br class="">Array&lt;T: SomeConstraint&gt;<br class=""><br class="">only has value semantics if T has value semantics, since SomeConstraint<br class="">presumably uses aspects of T other than reference identity. &nbsp;<br class=""><br class=""><blockquote type="cite" class="">The claim has been made that Array always has value semantics,<br class="">implying that the array value’s boundary ends at the boundary of it’s<br class="">element values.<br class=""></blockquote><br class="">Yes, an array value ends at the boundary of its elements' values.<br class=""><br class=""><blockquote type="cite" class="">That fact is what allows the compiler to ignore mutation of the<br class="">buffer.<br class=""></blockquote><br class="">I don't know what you mean here.<br class=""><br class=""><blockquote type="cite" class="">It's perfectly clear that Array&lt;T&gt; is a PureValue iff T is a PureValue.<br class="">PureValue is nothing more than transitive value semantics.<br class=""></blockquote><br class="">You're almost there. &nbsp;“Transitive” implies that you are going to look at<br class="">the parts of a type to see if they are also PureValue's. &nbsp;So which parts<br class="">of the Array struct does one look at, and why? &nbsp;Just tell me the<br class="">procedure for determining whether a type is a PureValue.<br class=""></blockquote><br class="">We look at the observable parts. &nbsp;<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">That begs the question. &nbsp;The “parts” of an Array are the observable</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">features that are considered by equality.</span></div></blockquote><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">We do not look at unobservable parts because we want flexibility to<br class="">use things like CoW, shared immutable references, etc in our<br class="">implementation.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">IMO the important thing when it comes to functional purity is not what</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">you *can* observe, but what you *do* observe.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Can you share your definition of value semantics? &nbsp;</blockquote></div></blockquote><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Explaining it well and in sufficient detail for this discussion takes</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">some doing</span></div></blockquote><div><br class=""></div><div>I asked for your definition of value semantics because you keep asking for a concise definition of PureValue. &nbsp;I was trying to identify how to structure a definition in a way that would be acceptable to you. &nbsp;&nbsp;</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">, but I think John Lakos and I share an understanding of value</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">semantics and he has a really detailed explanation in</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://www.youtube.com/watch?v=W3xI1HJUy7Q" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://www.youtube.com/watch?v=W3xI1HJUy7Q</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space">&nbsp;</span>and</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://www.youtube.com/watch?v=0EvSxHxFknM" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://www.youtube.com/watch?v=0EvSxHxFknM</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">. &nbsp;He uses C++ in places,</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">but it's not particularly advanced, and the fundamental ideas apply just</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">as well to Swift.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div>Thanks, good talks. &nbsp;I believe I have seen earlier versions of them previously.</div><div><br class=""></div><div>I’m still unsure of what structure would be acceptable to you as John doesn’t give a concise “here it is on one slide” definition of the kind you seem to be looking for with regards to pure value. &nbsp;If anything, the talks demonstrate how nuanced this discussion is.</div><div><br class=""></div><div>That said, I’ll take a shot at defining pure value using John’s terminology. &nbsp;John talks about salient attributes quite a bit. &nbsp;These are the “observable parts” I have been talking about. &nbsp;</div><div><br class=""></div><div>John also makes a very strong and clear distinction between “value semantics” and “in-core value semantics”. &nbsp;This distinction is fundamental to the distinction I am making. &nbsp;Your definition of “value semantics” appears to include both what John calls “value semantics” as well as what John calls “in-core value semantics”. &nbsp;As far as I can tell my definition of “pure value” aligns with what John simply calls “value semantics” (or in some cases he says “full value semantics”) which *excludes* what he calls “in-core value semantics” (including pointers). &nbsp;Quoting John:</div><div><br class=""></div><div>“What kind of objects do not try to represent a value? &nbsp;… Pointers actually represent something in the middle. &nbsp;They don’t represent an ethereal type because pointers are addresses in a local machine. &nbsp;That’s not a global property. &nbsp;On the other hand they bear some resemblance so we call them in-core value types but <b class="">they are not the same.</b>"</div><div><br class=""></div><div>John uses “ethereal” interchangeably with platonic in his talk. &nbsp;In his mind value semantic types are implementations that approximate platonic (or mathematical) values. &nbsp;In other words, the interpretation / meaning of the value is eternal and is not tied to the current state of memory in the process that is executing.</div><div><br class=""></div><div>The fundamental distinction between value semantics and pure value hinges on what salient attributes are allowable. &nbsp; Pure values cannot have any salient attributes with what John is calling “in-core value semantics”. &nbsp;All of the salient attributes of a pure value have what John is simply calling "value semantics”, or in other words are themselves pure values.</div><div><div><br class=""></div><div>John doesn’t specifically discuss the semantics of something like vector&lt;shared_ptr&lt;T&gt;&gt; but I believe he would agree that it has different semantics than vector&lt;int&gt; in a fundamental and important way.</div><div><br class=""></div><div>-Matthew</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">It may be helpful<br class="">if we start there and refine your definition to exclude impure value<br class="">types like Array&lt;UIView&gt;.<br class=""><br class="">In the meantime I’ll take another shot:<br class=""><br class="">1. Scalars are pure values.<br class=""><br class="">2. Any aggregate type with value semantics is a pure value iff all<br class="">&nbsp;&nbsp;observable parts of the aggregate are pure values.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">--<span class="Apple-converted-space">&nbsp;</span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">-Dave</span></div></blockquote></div><br class=""></body></html>