Skip to content

Commit 36e7604

Browse files
committed
Updated SE-0101 to use Void return values rather than (), fixed typo, and clarified choice between of and ofValue
1 parent e432888 commit 36e7604

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

proposals/0101-standardizing-sizeof-naming.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public func memorySize<T>(_: T.Type) -> Int
8686
/// Returns the contiguous memory footprint of `T`.
8787
///
8888
/// 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
9090
/// same regardless of how many stored properties `a` has.
9191
public func memorySize<T>(ofValue: T) -> Int
9292

@@ -107,14 +107,14 @@ public func memoryAlignment<T>(ofValue: T) -> Int
107107

108108
### Design Notes
109109

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`.
111111

112112
**Using Autoclosure**: It may make sense to use `@autoclosure` for value variants as the call shouldn't need its arguments evaluated:
113113

114114
```swift
115-
public func memorySize<T>(ofValue _: @autoclosure T -> ()) -> Int
116-
public func memoryInterval<T>(ofValue _: @autoclosure T -> ()) -> Int
117-
public func memoryAlignment<T>(ofValue _: @autoclosure T -> ()) -> Int
115+
public func memorySize<T>(ofValue _: @autoclosure T -> Void) -> Int
116+
public func memoryInterval<T>(ofValue _: @autoclosure T -> Void) -> Int
117+
public func memoryAlignment<T>(ofValue _: @autoclosure T -> Void) -> Int
118118
```
119119

120120
**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

Comments
 (0)