[swift-evolution] [Review] SE-0101: Rename sizeof and related functions to comply with API Guidelines
brent at architechies.com
Tue Jun 21 19:17:48 CDT 2016
> * What is your evaluation of the proposal?
Generally in support, with two small exceptions:
1. I think the type variants should have the parameter label `of`. `memorySize(of: Int.self)` reads grammatically (other than the hopefully soon-to-be-vestigial `self`); `memorySize(Int.self)` does not.
2. I am not convinced that the `ofValue` variants are valuable enough to keep, although they do help support the (I think necessary, though I could probably be convinced otherwise now that these three all have a `memory` prefix) change to `type(ofValue:)`.
(Actually, I'm now considering the idea that these should be `valueSize(of: T.Type)`, etc., since they measure only the size of the immediate value, not any objects that value might reference. But that thought is underdeveloped, so I'm not ready to stand behind it.)
> * Is the problem being addressed significant enough to warrant a change to Swift?
Yes; these are inconsistent with the API guidelines.
> * Does this proposal fit well with the feel and direction of Swift?
> * If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
I like that it's a little clearer what sort of "size" is meant; people are unlikely to imagine this will tell them an array's length, for instance.
> * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
More information about the swift-evolution