<div dir="ltr">Good point; ideally, there would be no initializers at all.<div class="gmail_extra">
<br><div class="gmail_quote">On Thu, Jun 30, 2016 at 10:24 AM, David Sweeris <span dir="ltr">&lt;<a href="mailto:davesweeris@mac.com" target="_blank">davesweeris@mac.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Agreed. Also, if we’re supposed to say `MemoryLayout.of()` now, does MemoryLayout still need a public init? Half of the proposal’s problems revolve around the likely-unexpected behavior caused by passing T.self to the init function (although, argument labels would also solve the issue).<div><br></div><div>- Dave Sweeris</div><div><div class="h5"><div><br><div>On Jun 29, 2016, at 10:05 PM, Jacob Bandes-Storch via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<div><blockquote type="cite"><br><div><div dir="ltr">I&#39;m not sure this bikeshed is the right color yet.<br><div><br></div><div>How does the user remember the distinction between MemoryLayout&lt;Int&gt; and MemoryLayout.of(Int) ? To keep it clear, how about ofValue() rather than of() ?</div><div><br></div><div>Also, could the implementation be simply</div><div><br></div><div>    static func ofValue(_ value: @autoclosure () -&gt; T) -&gt; MemoryLayout&lt;T&gt;.Type {</div><div>        return self</div><div>    }</div><div><br></div><div>?</div><div class="gmail_extra"><br clear="all"><div><div data-smartmail="gmail_signature"><div dir="ltr"><div>Jacob<br></div></div></div></div>
<br><div class="gmail_quote">On Wed, Jun 29, 2016 at 7:36 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><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><br><div><blockquote type="cite"><div>On Jun 29, 2016, at 3:59 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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jun 29, 2016 at 4:50 PM, David Sweeris <span dir="ltr">&lt;<a href="mailto:davesweeris@mac.com" target="_blank">davesweeris@mac.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">That’s the “as proposed” usage for getting the size of a value (from <a href="https://gist.github.com/erica/57a64163870486468180b8bab8a6294e" target="_blank">https://gist.github.com/erica/57a64163870486468180b8bab8a6294e</a>) <div><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:14px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal;color:rgb(51,51,51)"><span style="color:rgb(150,152,150)">// Types</span>
MemoryLayout<span style="color:rgb(167,29,93)">&lt;</span><span style="color:rgb(0,134,179)">Int</span><span style="color:rgb(167,29,93)">&gt;.</span>size <span style="color:rgb(150,152,150)">// 8 </span>
MemoryLayout<span style="color:rgb(167,29,93)">&lt;</span><span style="color:rgb(0,134,179)">Int</span><span style="color:rgb(167,29,93)">&gt;.</span>arraySpacing <span style="color:rgb(150,152,150)">// 8</span>
MemoryLayout<span style="color:rgb(167,29,93)">&lt;</span><span style="color:rgb(0,134,179)">Int</span><span style="color:rgb(167,29,93)">&gt;.</span>alignment <span style="color:rgb(150,152,150)">// 8</span>

<span style="color:rgb(150,152,150)">// Value</span>
<span style="color:rgb(167,29,93)">let</span> x: <span style="color:rgb(0,134,179)">UInt8</span> <span style="color:rgb(167,29,93)">=</span> <span style="color:rgb(0,134,179)">5</span>
MemoryLayout(x)<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">dynamicType</span><span style="color:rgb(167,29,93)">.</span>size <span style="color:rgb(150,152,150)">// 1</span>
MemoryLayout(<span style="color:rgb(24,54,145)"><span>&quot;</span>hello<span>&quot;</span></span>)<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">dynamicType</span><span style="color:rgb(167,29,93)">.</span>arraySpacing <span style="color:rgb(150,152,150)">// 24</span>
MemoryLayout(<span style="color:rgb(0,134,179)">29</span><span style="color:rgb(167,29,93)">.</span><span style="color:rgb(0,134,179)">2</span>)<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">dynamicType</span><span style="color:rgb(167,29,93)">.</span>alignment <span style="color:rgb(150,152,150)">// 8</span></pre><div><br></div><div><br></div>At least, I <i>thought</i> that was the latest version of the proposal. Maybe I’ve gotten confused.</div></div></blockquote><div><br></div><div>There must be a typo in these examples. `MemoryLayout(x.dynamicType).size` perhaps?</div></div></div></div></div></blockquote><br></div></span><div>I have listened. I have updated.</div><div><br></div><div><a href="https://gist.github.com/erica/57a64163870486468180b8bab8a6294e" target="_blank">https://gist.github.com/erica/57a64163870486468180b8bab8a6294e</a></div><div><br></div><div><span><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span>// Types</span></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span>MemoryLayout</span><span>&lt;</span><span style="color:#703daa">Int</span><span>&gt;.</span><span>size</span><span> </span><span style="color:#008400">// 8</span></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span>MemoryLayout</span><span>&lt;</span><span style="color:#703daa">Int</span><span>&gt;.</span><span>arraySpacing</span><span> </span><span style="color:#008400">// 8</span></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span>MemoryLayout</span><span>&lt;</span><span style="color:#703daa">Int</span><span>&gt;.</span><span>alignment</span><span> </span><span style="color:#008400">// 8</span></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;min-height:19px"><span></span><br></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span>// Value</span></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo"><span style="color:#bb2ca2">let</span><span> x: </span><span style="color:#703daa">UInt8</span><span> = </span><span style="color:#272ad8">5</span></div></span><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span>MemoryLayout</span><span>.</span><span style="color:#31595d">of</span><span>(</span><span>x</span><span>).</span><span>size</span><span> </span><span style="color:#008400">// 1</span></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span>MemoryLayout</span><span>.</span><span style="color:#31595d">of</span><span>(</span><span style="color:#272ad8">1</span><span>).</span><span>size</span><span> </span><span style="color:#008400">// 8</span></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span>MemoryLayout</span><span>.</span><span style="color:#31595d">of</span><span>(</span><span style="color:#d12f1b">&quot;hello&quot;</span><span>).</span><span>arraySpacing</span><span> </span><span style="color:#008400">// 24</span></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span>MemoryLayout</span><span>.</span><span style="color:#31595d">of</span><span>(</span><span style="color:#272ad8">29.2</span><span>).</span><span>alignment</span><span> </span><span style="color:#008400">// 8</span></div><span><font color="#888888"><div><span style="color:#008400"><br></span></div><div><span style="color:#008400"><br></span></div><div><span style="color:#008400">-- E</span></div></font></span></div><br></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>
_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br></div></div></div></div></div></blockquote></div><br></div></div>