<div style="white-space:pre-wrap">Well, as I understand it, it&#39;s not actually possible to write your own type(of:), so we&#39;re going from a &quot;magic&quot; property to a &quot;magic&quot; function at least for now.<br><br>I&#39;m most alarmed that one implication of the MemoryLayout proposal is loss of the `ofValue` family of functions. These functions don&#39;t fit with the design: imagine, what is `MemoryLayout&lt;Double&gt;.size(ofValue: Float(42))`? But the response seems to be that these functions don&#39;t seem necessary at all and should be removed. &quot;I don&#39;t see a use for it&quot; is an insufficient justification for a feature removal. Looking to other languages, C# has sizeof as a static property but tellingly offers the equivalent of sizeofValue (well, strideofValue) as a function in a different module. Essentially every other C-family language that exposes pointers to the user offers both of and ofValue equivalents. The question is, how does a user with existing code using sizeofValue() migrate to Swift 3? I do not see a viable answer with the MemoryLayout design.<br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 2, 2016 at 8:03 AM Matthew Johnson &lt;<a href="mailto:matthew@anandabits.com">matthew@anandabits.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><span></span></div><div><div><br><br>Sent from my iPad</div></div></div><div dir="auto"><div><div><br>On Jun 2, 2016, at 12:27 AM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">On Thu, Jun 2, 2016 at 12:24 AM, Patrick Smith <span dir="ltr">&lt;<a href="mailto:pgwsmith@gmail.com" target="_blank">pgwsmith@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>I really like this idea. This IMO is lower level functionality than `type(of:)` (née dynamicType), so I think it makes sense for it to be grouped under its own domain, the MemoryLayout type.</div><div><br></div><div>Plus MemoryLayout can be extended with new convenience methods.</div><div><br></div><div>I’m fine with those old methods being removed, but I never use them so! Is it the same as calling type(of:) then using that with MemoryLayout? I imagine they could be fixit’d easily, and that they compile down to the same underlying code.</div></div></blockquote><div><br></div><div>I&#39;m actually souring to the idea. It goes in the diametrically opposite direction from dynamicType. There, something was changed from being property-like to being function-like. Here, Dave&#39;s proposal would take something that&#39;s a function and turn it into a property. Hmm.</div></div></div></div></div></blockquote><div><br></div></div></div><div dir="auto"><div><div>That&#39;s not a fair comparison though.  With dynamicType we removed a &quot;magic&quot; property visible on all types, which isn&#39;t something you can write and turned it into a function (which is obviously something you can write).  </div><div><br></div><div>Dave&#39;s MemoryLayout creates a new type to bundle together related items which makes their semantic relationship more clear.  It also receives the type via a generic argument rather than a function argument and makes the properties static.  That is more representative of what is actually happening and could help to prevent confusion.  </div><div><br></div><div>If we really need an &#39;ofValue&#39; option that infers T from a value the properties on MemoryLayout could also be made available as instance properties and it could have an initializer that accepts an instance to T and throws the value away.  However, I&#39;m not at all convinced this is necessary.</div></div></div><div dir="auto"><div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span><div><blockquote type="cite"><div>On 2 Jun 2016, at 3:05 PM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">2. Dave A. and others expressed the opinion that these should probably not be global functions; his preference was for:</div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">```</div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">MemoryLayout&lt;T&gt;.size // currently sizeof()</div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">MemoryLayout&lt;T&gt;.spacing // currently strideof()</div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">MemoryLayout&lt;T&gt;.alignment // currently alignof()</div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">```</div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">3. Dave A. proposed that sizeofValue(), strideofValue(), and alignofValue() are better off removed altogether. I don&#39;t know if people are going to be happy about this idea.</div></div></blockquote></div><br></span></div></blockquote></div><br></div></div>
</div></blockquote></div></div><div dir="auto"><div><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></div></blockquote></div>