Commit Graph

19 Commits

Author SHA1 Message Date
Jager-yoo
60dc7cda12 Revise: applied trailing closure syntax to some examples
- For clearer closure style with shorthand argument names.
2022-05-12 02:58:05 +09:00
Slava Pestov
2716874f01 stdlib: Remove some redundant generic requirements 2022-04-04 15:52:05 -04:00
Robert Widmann
c5a751212d Merge pull request #36446 from wonhee009/Result 2021-03-21 09:58:14 -07:00
Doug Gregor
9579390024 [SE-0304] Rename ConcurrentValue to Sendable 2021-03-18 22:48:20 -07:00
wonhee
09971acf8c fix Result flatMapError remark 2021-03-16 14:03:18 +09:00
Doug Gregor
1a1f79c0de Introduce safety checkin for ConcurrentValue conformance.
Introduce checking of ConcurrentValue conformances:
- For structs, check that each stored property conforms to ConcurrentValue
- For enums, check that each associated value conforms to ConcurrentValue
- For classes, check that each stored property is immutable and conforms
  to ConcurrentValue

Because all of the stored properties / associated values need to be
visible for this check to work, limit ConcurrentValue conformances to
be in the same source file as the type definition.

This checking can be disabled by conforming to a new marker protocol,
UnsafeConcurrentValue, that refines ConcurrentValue.
UnsafeConcurrentValue otherwise his no specific meaning. This allows
both "I know what I'm doing" for types that manage concurrent access
themselves as well as enabling retroactive conformance, both of which
are fundamentally unsafe but also quite necessary.

The bulk of this change ended up being to the standard library, because
all conformances of standard library types to the ConcurrentValue
protocol needed to be sunk down into the standard library so they
would benefit from the checking above. There were numerous little
mistakes in the initial pass through the stsandard library types that
have now been corrected.
2021-02-04 03:45:09 -08:00
Erik Eckstein
e7efa6cb15 stdlib: Make Result methods inlinable
The "Result" type is expected to have no overhead when used.
This requires the member functions to be inlinable.
Which is probably okay for library evolution, because it's unlikely that those methods change in an incompatible way.
2020-07-29 21:57:51 +02:00
eunjiChung
ffe471ada8 [stdlib] Add flatMap example in Result.swift 2020-06-04 21:39:12 +09:00
eunjiChung
cf9fcb975d [stdlib] Add flatMap example in Result.swift 2020-05-31 17:43:22 +09:00
Valeriy Van
9a551ab9d7 Uses default catch 2020-05-02 16:32:36 +02:00
Valeriy Van
75f30676b9 Fixes example snippet in Result.swift 2020-05-02 13:30:49 +02:00
Ben Cohen
e9d4687e31 De-underscore @frozen, apply it to structs (#24185)
* De-underscore @frozen for enums

* Add @frozen for structs, deprecate @_fixed_layout for them

* Switch usage from _fixed_layout to frozen
2019-05-30 17:55:37 -07:00
Nate Cook
f19aca6cb0 [WIP] Revise documentation for Swift 5 stdlib additions (#21333)
* Revise the Unicode scalar/Character properties
* Minor revisions to `compactMapValues` docs.
* Add documentation for AdditiveArithmetic, revise Numeric
* Apply minor style updates to count(where:).
* Revise string interpolation docs.

- Convert table of interpolation examples to a list of examples. Tables
aren't supported by Swift markup, so this wouldn't render properly in
Xcode or on the web.
- Add a description of what a user must implement in a custom
string interpolation type to get the behavior they want.

* Revise isMultiple(of:) docs.

- In particular, add emphasis to mathematical symbols and equations to
match how we document such things elsewhere.
- I'm using asterisks for single symbols, and underscores for equations
because it's easier to read in-source when you don't have to escape
multiplication within emphasis.

* Add some abstracts to the SIMD vector types.

- Adds a dictionary of spelled out numbers. Only numbers < 10
  should be spelled out according to editorial.
- Adds abstracts to some of the basic members.
- Includes parameter descriptions for the xyzw properties and inits,
but not for the unlabeled initializers. Combined with the protocol
extension method abstracts, this should complete coverage of the concrete
types.
2019-01-03 18:19:20 -06:00
Nate Cook
2bb0b5c842 Revise some documentation comments. 2018-12-10 14:31:28 -06:00
Jon Shier
c739498c9b Remove usage lines from docs. 2018-12-09 19:20:49 -05:00
Jon Shier
e4a700c32d Update inline documentation. 2018-12-09 19:08:41 -05:00
Jon Shier
2bc4cbbfdd Update for revised proposal. 2018-12-05 23:17:35 -05:00
Jon Shier
7fb5905f5f Updates for review comments. 2018-12-03 21:52:21 -05:00
Jon Shier
33dcfc462f Add update Result type to standard library. 2018-12-02 22:15:02 -05:00