Skip to content

Commit d40c03f

Browse files
committed
[doc][stdlib] Tiny edits
1 parent e32db08 commit d40c03f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/StandardLibraryProgrammersManual.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ To ease reading/understanding type declarations, we prefer to define members in
7373

7474
Please keep all stored properties together in a single uninterrupted list, followed immediately by the type's most crucial initializer(s). Put these as close to the top of the type declaration as possible -- we don't want to force readers to scroll around to find these core definitions.
7575

76-
The main declaration ought to be kept as short as possible -- preferably it should consist of the type's stored properties and a handful of critical initializers, and nothing else.
76+
The main `struct`/`class` definiton ought to be kept as short as possible -- preferably it should consist of the type's stored properties and a handful of critical initializers, and nothing else.
7777
Everything else should go in standalone extensions, arranged by logical theme. For example, it's often better to define protocol conformances in dedicated extensions. Think about what order you present these -- put related conformances together, follow some didactic arc, etc. (E.g, conformance definitions for `Equatable`/`Hashable`/`Comparable` should be kept very close to each other, for easy referencing.)
7878

7979
It's okay for the core type declaration to forward reference large nested types or static members that are defined in subsequent extensions. It's often a good idea to define these in an extension immediately following the type declaration, but this is not a strict rule. The goal is to make things easy to understand -- if a type is small enough, it may be fine to put every member directly in the `struct`/`class` definition, while it may make sense to break the definition of a huge type into a number of source files.
@@ -105,7 +105,7 @@ struct Foo: RandomAccessCollection, Hashable {
105105
}
106106

107107
// GOOD
108-
struct Foo: RandomAccessCollection, Hashable {
108+
struct Foo {
109109
var _storage: _FooStorage
110110

111111
init(foo: Int, bar: Double) { ... }

0 commit comments

Comments
 (0)