[swift-evolution] [Pitch] Renaming sizeof, sizeofValue, strideof, strideofValue

Matthew Johnson matthew at anandabits.com
Thu Jun 2 11:12:43 CDT 2016


> On Jun 2, 2016, at 11:04 AM, Erica Sadun <erica at ericasadun.com> wrote:
> 
> 
>> On Jun 2, 2016, at 9:48 AM, Matthew Johnson via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> struct MemoryLayout<T> {
>>     init() {}
>>     init(t: T) { /* throw away the value */ }
>>     
>>     // we could omit the static properties and require 
>>     // writing MemoryLayout<Int>() if we don’t like the duplication
>>     static let size: Int
>>     static let spacing: Int
>>     static let alignment: Int
>> 
>>     let size: Int
>>     let spacing: Int
>>     let alignment: Int
>> }
>> 
>> let size = MemoryLayout<Int>.size
>> let sizeOfValue = MemoryLayout(42).size
> 
> And amended Alternatives with this. :)

Thanks!  Can you change the init signature with Pyry’s improvement: `init(_: @autoclosure () -> T) {}`?

> 
> - E
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160602/1fcbfcf3/attachment.html>


More information about the swift-evolution mailing list