<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-08-04 10:31 GMT+03:00 Xiaodi Wu via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span>:<br></div><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 Thu, Aug 4, 2016 at 2:29 AM, Karl <span dir="ltr">&lt;<a href="mailto:razielim@gmail.com" target="_blank">razielim@gmail.com</a>&gt;</span> wrote:</span><div class="gmail_extra"><div class="gmail_quote"><span class=""><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><div>It’s confusing because metatypes in Swift are pretty confusing in general: Int.self returns Int.Type which is not the same as `type(of: &lt;some Int&gt;)` (that would be Int).</div><div><br></div><div>If a novice wants to jump in, they’ll have to know that MemoryLayout(of: Int.self) would return a MemoryLayout&lt;Int.Type&gt;.</div></div></div></blockquote><div><br></div></span><div>Yes, here, I agree Dave is absolutely right. You and Dave have convinced me that neither `MemoryLayout(of: x)` nor `MemoryLayout.of(x)`, where x is an instance, would be appropriate.</div></div></div></div></blockquote></div><br></div><div class="gmail_extra">Two weeks ago Adrian and I suggested adding dynamic &#39;size&#39;, &#39;stride&#39;, &#39;alignment&#39; to Mirror, which definition would look like:</div><div class="gmail_extra"><br></div><div class="gmail_extra">public struct Mirror {</div><div class="gmail_extra">    internal metatype_: Any.Type</div><div class="gmail_extra"><br></div><div class="gmail_extra">    public init&lt;T&gt;(_: T.Type)</div><div class="gmail_extra"><br></div><div class="gmail_extra">    public var size: Int { get }</div><div class="gmail_extra">    public var stride: Int { get }</div><div class="gmail_extra">    public var align: Int { get }</div><div class="gmail_extra"><br></div><div class="gmail_extra">    // ...</div><div class="gmail_extra">}</div><div class="gmail_extra"><br></div><div class="gmail_extra">There are some problems with it right now, but I do believe that reflection API is where dynamic `size`, `stride`, `alignment` belong.</div></div>