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

Jose Cheyo Jimenez cheyo at masters3d.com
Mon May 2 15:24:43 CDT 2016


I agree that the names could be more specific but I do agree that putting these methods on `Any` is a good idea.
(I am not saying that `Any` should be open to user extensions though.) 


> On May 2, 2016, at 1:10 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> on Mon May 02 2016, Joe Groff <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
>>> 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.
> 
> I very much disagree.  I don't want to see Array(1..<100).size == 24.
> 
> -- 
> Dave
> 
> _______________________________________________
> 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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160502/7d3114a1/attachment.html>


More information about the swift-evolution mailing list