<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><br>Sent from my iPad</div><div><br>On Jun 2, 2016, at 12:05 AM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">On Wed, Jun 1, 2016 at 11:55 PM, Xiaodi Wu <span dir="ltr"><<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>></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"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></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, "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."<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 "sizeof" 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't the best name for something that doesn'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<T>.size // currently sizeof()</div><div class="gmail_extra">MemoryLayout<T>.spacing // currently strideof()</div><div class="gmail_extra">MemoryLayout<T>.alignment // currently alignof()</div><div class="gmail_extra">```</div></div></div></blockquote><div><br></div>Thanks for the summary. I missed the original thread. <div><br></div><div>I think I like this approach despite its verbosity. Will give it a little bit more thought...<br><div><br><blockquote type="cite"><div><div dir="ltr"><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'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's actually sizeofValue(), etc., that should be renamed size(of:), etc. Also, a fun tidbit is that what'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'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>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></div></body></html>