[swift-evolution] Trial balloon: conforming sizeof, sizeofValue, etc. to naming guidelines

Joe Groff jgroff at apple.com
Mon May 2 12:47:36 CDT 2016


> On May 2, 2016, at 9:46 AM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> on Sun May 01 2016, Xiaodi Wu <xiaodi.wu-AT-gmail.com> wrote:
> 
>> It's a bad habit of mine, I guess, to err on the side of suggesting conservative
>> changes on the assumption that it'll be maximally acceptable. If there's
>> appetite for a more serious renaming, and as you say these are considered
>> relatively rarely used, then it's a world of possibility!
>> 
>> We could do as Shawn suggested and follow precedent in some other languages by
>> moving these functions out of the global scope. Perhaps these will meet with
>> some satisfaction:
>> 
>> ```
>> Memory.footprint(of:)
>> Memory.alignment(of:)
>> Memory.spacing(of:)
>> ```
> 
> I'd rather have 
> 
> MemoryLayout<T>.size
> MemoryLayout<T>.alignment
> MemoryLayout<T>.spacing

This would be a legit use for 'extension Any'. IMO it'd be even better as just T.size, T.alignment, T.spacing.

-Joe


More information about the swift-evolution mailing list