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

Russ Bishop xenadu at gmail.com
Thu Jun 2 16:26:31 CDT 2016


> On Jun 2, 2016, at 2:05 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
> 
> In the earlier conversation, it was pointed out (by Dave A., I think?) that examples such as Array.size show how this solution can get confusing. And even though there aren't fixed-length arrays in Swift, those may come one day, making the syntax even more confusing.


Array.count is a function taking an instance; I’m not sure I agree it would be terribly confusing… then again I run in Xcode with the quick help pane open so I see the doc comments for every type, property, and function as I move around the code. It’s quite handy :)

I could see including memory in the name (or something similar) if we want to be extra clear about it.

    Int.memorySize
    Int.memoryAlignment


Ultimately the type’s size in memory is a property of the type so it seems clear that is where it belongs (being careful not to steal too much of the namespace of course).


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


More information about the swift-evolution mailing list