You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: proposals/0101-standardizing-sizeof-naming.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,7 +86,7 @@ public func memorySize<T>(_: T.Type) -> Int
86
86
/// Returns the contiguous memory footprint of `T`.
87
87
///
88
88
/// Does not include any dynamically-allocated or "remote" storage.
89
-
/// In particular, `memorySize(of: a)`, when `a` is a class instance, is the
89
+
/// In particular, `memorySize(ofValue: a)`, when `a` is a class instance, is the
90
90
/// same regardless of how many stored properties `a` has.
91
91
publicfuncmemorySize<T>(ofValue: T) ->Int
92
92
@@ -107,14 +107,14 @@ public func memoryAlignment<T>(ofValue: T) -> Int
107
107
108
108
### Design Notes
109
109
110
-
**Labels**: This design omits labels for types. It uses `ofValue` for values, assuming SE-0096 would update to match. This proposal recommends matching SE-0096 regardless of the core team decision.
110
+
**Labels**: This design omits labels for types. It uses `ofValue` for values, assuming SE-0096 would update to match. This proposal recommends matching SE-0096 regardless of the core team choice: either `of` or `ofValue`.
111
111
112
112
**Using Autoclosure**: It may make sense to use `@autoclosure` for value variants as the call shouldn't need its arguments evaluated:
113
113
114
114
```swift
115
-
publicfuncmemorySize<T>(ofValue_: @autoclosure T ->()) ->Int
116
-
publicfuncmemoryInterval<T>(ofValue_: @autoclosure T ->()) ->Int
117
-
publicfuncmemoryAlignment<T>(ofValue_: @autoclosure T ->()) ->Int
115
+
publicfuncmemorySize<T>(ofValue_: @autoclosure T ->Void) ->Int
116
+
publicfuncmemoryInterval<T>(ofValue_: @autoclosure T ->Void) ->Int
117
+
publicfuncmemoryAlignment<T>(ofValue_: @autoclosure T ->Void) ->Int
118
118
```
119
119
120
120
**Accepting Type Variations**: The core team may choose omit the value variants entirely, replacing just three freestanding functions and removing the other three. In doing so, users must call `type` on passed values. This pattern is already found in standard library code.
0 commit comments