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

Chris Lattner clattner at apple.com
Mon May 2 16:32:50 CDT 2016


On May 2, 2016, at 1:10 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>>> 
>>> 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.
> 
> I very much disagree.  I don't want to see Array(1..<100).size == 24.

I agree with Dave here.  Even if these got more verbose names (to avoid confusion with count), it is still unfortunate to pollute code completion for these uncommonly used "operators”.  I’m coming around to agree with Dave’s view that dynamicType should be made into a global function for the same reason. 

-Chris


More information about the swift-evolution mailing list