Skip to content

Commit

Permalink
[docs] Add "currency type" to the lexicon (#40874)
Browse files Browse the repository at this point in the history
* Unclear word

* Update Lexicon.md

* Update README.md

* Update docs/Lexicon.md

Co-authored-by: Robert Widmann <[email protected]>

* Update Lexicon.md

* Update docs/README.md

Co-authored-by: Robert Widmann <[email protected]>

* Update docs/README.md

Co-authored-by: Xiaodi Wu <[email protected]>

Co-authored-by: Robert Widmann <[email protected]>
Co-authored-by: Xiaodi Wu <[email protected]>
  • Loading branch information
3 people authored Jan 18, 2022
1 parent 6f4e3df commit bdce80f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions docs/Lexicon.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,19 @@ the AST level. See also [witness table](#witness-table).
An edge in a control flow graph where the destination has multiple predecessors
and the source has multiple successors.

## currency type

A type that's meant to be commonly passed around and stored, like `Array`, as
opposed to a type that's useful for temporary/internal purposes but which you
wouldn't normally use in an external interface, like `ArraySlice`. Having broad
agreement about the currency type you use for a particular kind of data (e.g.
using `Array` to pass around sequential collections) generally makes the whole
ecosystem better by reducing artificial barriers to passing data from one system
to another, and it gives algorithm writers an obvious target to ensure they
optimize for. That's where the analogy to currency comes from: agreeing on a
currency type improves the flow of information in a program in some of the same
ways that agreeing on a currency improves the flow of trade in an economy.

## customization point

Informal term for a protocol requirement that has a default implementation,
Expand Down
3 changes: 2 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ documentation, please create a thread on the Swift forums under the
Describes the design of the optimizer pipeline.
- [HighLevelSILOptimizations.rst](/docs/HighLevelSILOptimizations.rst):
Describes how the optimizer understands the semantics of high-level
operations on currency data types and optimizes accordingly.
operations on [currency](/docs/Lexicon.md#currency-type) data types and
optimizes accordingly.
Includes a thorough discussion of the `@_semantics` attribute.

### SourceKit subsystems
Expand Down

0 comments on commit bdce80f

Please sign in to comment.