Skip to content

[docs] Add "currency type" to the lexicon #40874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 18, 2022
Merged

Conversation

philipturner
Copy link
Contributor

I don't understand why it says "currency", which means money. There might be some Swift data type for money, but I haven't heard of it yet. Also, the explanation misses that the entire document just covers built-in Swift types. Did you mean "concurrency"?

Copy link
Contributor

@CodaFi CodaFi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a difference here!

The compiler understands Builtin types like Builtin.NativeObject, and it understands much higher-level common user types like String. The types in the standard library are not considered builtins - they're built atop builtins more often than not. The document linked here describes optimization opportunities exposed by annotations and structures attached these higher-level types and associated operations.

"Currency" (often also "vocabulary") types are types that one reaches for in most common usages of the language. Do you want to manipulate a string - pick String, not UnsafeMutableBufferPointer<CChar>. Do you want a pack of unique elements - pick Set<T>!

@philipturner
Copy link
Contributor Author

philipturner commented Jan 16, 2022

Then could the documentation clarify what "currency" means or provide a hyperlink? I didn't see it in Lexicon.md, and from the point of view of someone who doesn't know what it means, it looks like a misspelling of "Concurrency".

@philipturner philipturner requested a review from CodaFi January 16, 2022 23:30
@WowbaggersLiquidLunch
Copy link
Contributor

also relevant answer on the forums: https://forums.swift.org/t/what-does-currency-type-mean/41065/2

@philipturner
Copy link
Contributor Author

philipturner commented Jan 17, 2022 via email

@philipturner
Copy link
Contributor Author

The definition for currency still needs to be refined, could anyone help me here?

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

@CodaFi CodaFi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@CodaFi
Copy link
Contributor

CodaFi commented Jan 17, 2022

Note to self: manually squash this

@swift-ci smoke test

@xwu xwu changed the title Unclear word [docs] Add "currency type" to the lexicon Jan 18, 2022
Co-authored-by: Xiaodi Wu <[email protected]>
@philipturner
Copy link
Contributor Author

@CodaFi you may need to retest this because of a one-character change.

@xwu
Copy link
Collaborator

xwu commented Jan 18, 2022

@swift-ci smoke test

@CodaFi CodaFi merged commit bdce80f into swiftlang:main Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants