Skip to content

Commit bdce80f

Browse files
philipturnerCodaFixwu
authored
[docs] Add "currency type" to the lexicon (swiftlang#40874)
* Unclear word * Update Lexicon.md * Update README.md * Update docs/Lexicon.md Co-authored-by: Robert Widmann <devteam.codafi@gmail.com> * Update Lexicon.md * Update docs/README.md Co-authored-by: Robert Widmann <devteam.codafi@gmail.com> * Update docs/README.md Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com> Co-authored-by: Robert Widmann <devteam.codafi@gmail.com> Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com>
1 parent 6f4e3df commit bdce80f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

docs/Lexicon.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,19 @@ the AST level. See also [witness table](#witness-table).
137137
An edge in a control flow graph where the destination has multiple predecessors
138138
and the source has multiple successors.
139139

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

142155
Informal term for a protocol requirement that has a default implementation,

docs/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ documentation, please create a thread on the Swift forums under the
131131
Describes the design of the optimizer pipeline.
132132
- [HighLevelSILOptimizations.rst](/docs/HighLevelSILOptimizations.rst):
133133
Describes how the optimizer understands the semantics of high-level
134-
operations on currency data types and optimizes accordingly.
134+
operations on [currency](/docs/Lexicon.md#currency-type) data types and
135+
optimizes accordingly.
135136
Includes a thorough discussion of the `@_semantics` attribute.
136137

137138
### SourceKit subsystems

0 commit comments

Comments
 (0)