<div dir="ltr">On Wed, Jun 1, 2016 at 11:55 PM, Xiaodi Wu <span dir="ltr">&lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@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 dir="ltr"><span class="">On Wed, Jun 1, 2016 at 11:28 PM, Erica Sadun via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br></span><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Upon accepting SE-0098, the core team renamed the proposed stdlib function from dynamicType() to type(of:).  They write, &quot;The core team recognizes that this means that we should probably resyntax the existing sizeof/strideof functions, but that should be a follow-on discussion.&quot;<br>
<br>
Follow on discussion started. Have at it.<br></blockquote><div><br></div></span><div>See: <a href="http://thread.gmane.org/gmane.comp.lang.swift.evolution/15830" target="_blank">http://thread.gmane.org/gmane.comp.lang.swift.evolution/15830</a></div><div> </div></div></div></div>
</blockquote></div><br></div><div class="gmail_extra">To summarize the previous discussion:</div><div class="gmail_extra"><br></div><div class="gmail_extra">1. Per Joe Groff, although sizeof() and friends are treated as terms-of-art, these names were lifted straight from C and do not correspond to anything named &quot;sizeof&quot; in LLVM.</div><div class="gmail_extra"><br></div><div class="gmail_extra">2. There are issues with using a name such as stride(of:), because stride(...) already means something else in the stdlib; moreover, size(of:) isn&#39;t the best name for something that doesn&#39;t do what its C namesake does; therefore, larger changes to the naming were suggested.</div><div class="gmail_extra"><br></div><div class="gmail_extra">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"><br></div><div class="gmail_extra">```</div><div class="gmail_extra">MemoryLayout&lt;T&gt;.size // currently sizeof()</div><div class="gmail_extra">MemoryLayout&lt;T&gt;.spacing // currently strideof()</div><div class="gmail_extra">MemoryLayout&lt;T&gt;.alignment // currently alignof()</div><div class="gmail_extra">```</div><div class="gmail_extra"><br></div><div class="gmail_extra">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 class="gmail_extra"><br></div><div class="gmail_extra">* * *</div><div class="gmail_extra"><br></div><div class="gmail_extra">If we take inspiration from type(of:), then it&#39;s actually sizeofValue(), etc., that should be renamed size(of:), etc. Also, a fun tidbit is that what&#39;s currently called sizeof(), etc.--the ones that take types rather than values--are actually not very good candidates for having parameter labels, because it&#39;s OK to write `sizeof(Int)`, but one must currently write `size(of: Int.self)` when the function has a label.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div>