[swift-evolution] [Review] SE-0101: Rename sizeof and related functions to comply with API Guidelines
Erica Sadun
erica at ericasadun.com
Thu Jun 30 13:10:12 CDT 2016
The only proposal that's in review is the one on github at Swift Evolution.
I have been putting together another version as a courtesy for Dave A, to flesh out how the alternative approach would look if the alternative was the primary proposal. That one is a personal gist.
-- E
> On Jun 30, 2016, at 12:00 PM, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
>
> As a meta-issue, it's been hard to make meaningful commentary during this review process because the latest proposal has been so rapidly shifting throughout. What, exactly, is the version we are reviewing at the moment? Can we have a few days to mull over that version specifically?
> On Thu, Jun 30, 2016 at 12:24 David Sweeris via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 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).
>
> - Dave Sweeris
>
> On Jun 29, 2016, at 10:05 PM, Jacob Bandes-Storch via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>> I'm not sure this bikeshed is the right color yet.
>>
>> How does the user remember the distinction between MemoryLayout<Int> and MemoryLayout.of(Int) ? To keep it clear, how about ofValue() rather than of() ?
>>
>> Also, could the implementation be simply
>>
>> static func ofValue(_ value: @autoclosure () -> T) -> MemoryLayout<T>.Type {
>> return self
>> }
>>
>> ?
>>
>> Jacob
>>
>> On Wed, Jun 29, 2016 at 7:36 PM, Erica Sadun via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>>> On Jun 29, 2016, at 3:59 PM, Xiaodi Wu via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>>
>>> On Wed, Jun 29, 2016 at 4:50 PM, David Sweeris <davesweeris at mac.com <mailto:davesweeris at mac.com>> wrote:
>>> That’s the “as proposed” usage for getting the size of a value (from https://gist.github.com/erica/57a64163870486468180b8bab8a6294e <https://gist.github.com/erica/57a64163870486468180b8bab8a6294e>)
>>> // Types
>>> MemoryLayout<Int>.size // 8
>>> MemoryLayout<Int>.arraySpacing // 8
>>> MemoryLayout<Int>.alignment // 8
>>>
>>> // Value
>>> let x: UInt8 = 5
>>> MemoryLayout(x).dynamicType.size // 1
>>> MemoryLayout("hello").dynamicType.arraySpacing // 24
>>> MemoryLayout(29.2).dynamicType.alignment // 8
>>>
>>>
>>> At least, I thought that was the latest version of the proposal. Maybe I’ve gotten confused.
>>>
>>> There must be a typo in these examples. `MemoryLayout(x.dynamicType).size` perhaps?
>>
>> I have listened. I have updated.
>>
>> https://gist.github.com/erica/57a64163870486468180b8bab8a6294e <https://gist.github.com/erica/57a64163870486468180b8bab8a6294e>
>>
>> // Types
>> MemoryLayout<Int>.size // 8
>> MemoryLayout<Int>.arraySpacing // 8
>> MemoryLayout<Int>.alignment // 8
>>
>> // Value
>> let x: UInt8 = 5
>> MemoryLayout.of(x).size // 1
>> MemoryLayout.of(1).size // 8
>> MemoryLayout.of("hello").arraySpacing // 24
>> MemoryLayout.of(29.2).alignment // 8
>>
>>
>> -- E
>>
>>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>>
>>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160630/3e0708f9/attachment.html>
More information about the swift-evolution
mailing list