<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 30, 2016 at 2:30 PM, Dave Abrahams <span dir="ltr"><<a href="mailto:dabrahams@apple.com" target="_blank">dabrahams@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
on Wed Jun 29 2016, Erica Sadun <erica-AT-ericasadun.com> wrote:<br>
<br>
>> On Jun 29, 2016, at 3:59 PM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
>><br>
</span><span class="">>> On Wed, Jun 29, 2016 at 4:50 PM, David Sweeris <<a href="mailto:davesweeris@mac.com">davesweeris@mac.com</a> <mailto:<a href="mailto:davesweeris@mac.com">davesweeris@mac.com</a>>> wrote:<br>
>> That’s the “as proposed” usage for getting the size of a value (from<br>
>> <a href="https://gist.github.com/erica/57a64163870486468180b8bab8a6294e" rel="noreferrer" target="_blank">https://gist.github.com/erica/57a64163870486468180b8bab8a6294e</a><br>
><br>
</span>>> <<a href="https://gist.github.com/erica/57a64163870486468180b8bab8a6294e" rel="noreferrer" target="_blank">https://gist.github.com/erica/57a64163870486468180b8bab8a6294e</a>>)<br>
<span class="">>> // Types<br>
>> MemoryLayout<Int>.size // 8<br>
>> MemoryLayout<Int>.arraySpacing // 8<br>
>> MemoryLayout<Int>.alignment // 8<br>
>><br>
>> // Value<br>
>> let x: UInt8 = 5<br>
>> MemoryLayout(x).dynamicType.size // 1<br>
>> MemoryLayout("hello").dynamicType.arraySpacing // 24<br>
>> MemoryLayout(29.2).dynamicType.alignment // 8<br>
>><br>
>><br>
>> At least, I thought that was the latest version of the proposal. Maybe I’ve gotten confused.<br>
>><br>
>> There must be a typo in these examples. `MemoryLayout(x.dynamicType).size` perhaps?<br>
><br>
> I have listened. I have updated.<br>
><br>
> <a href="https://gist.github.com/erica/57a64163870486468180b8bab8a6294e" rel="noreferrer" target="_blank">https://gist.github.com/erica/57a64163870486468180b8bab8a6294e</a><br>
><br>
> // Types<br>
> MemoryLayout<Int>.size // 8<br>
> MemoryLayout<Int>.arraySpacing // 8<br>
> MemoryLayout<Int>.alignment // 8<br>
><br>
> // Value<br>
> let x: UInt8 = 5<br>
> MemoryLayout.of(x).size // 1<br>
> MemoryLayout.of(1).size // 8<br>
> MemoryLayout.of("hello").arraySpacing // 24<br>
> MemoryLayout.of(29.2).alignment // 8<br>
<br>
</span>I am still very skeptical that anyone needs the “Value” version, and as<br>
long as we're resyntaxing I am inclined to take it away and see how many<br>
people complain. You can still always write it yourself.<br></blockquote><div><br></div><div>So long as the issue regarding querying an existential value's dynamic type is addressed, yes?</div><div><br></div><div>I mentioned this in a comment on the gist already, but I'm really not digging the "array" in `arraySpacing`. We've already moved from top-level "stride" to "memory layout spacing," gaining plenty of clarity. I'm skeptical that the "array" adds anything more. Moreover, it muddies the waters by mentioning a specific type (Array) in a context where you're querying the memory layout properties of another type.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Dave<br>
</font></span></blockquote></div><br></div></div>