Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Added a small section on type assertions. #152

Merged
merged 2 commits into from
Feb 16, 2016
Merged

Conversation

DanielRosenwasser
Copy link
Member

Usually, this will happen when you know the type of a value is more specific than its current type.

*Type assertions* are a way to tell the compiler "trust me, I know what I'm doing."
A type assertion is like a type cast in other languages, but where some languages might perform some special checking or restructuring of data, a type assertion has no runtime impact.
Copy link
Member

Choose a reason for hiding this comment

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

you mention "other languages" twice. I'd reword to "A type assertion is like a type cast in other languages, but performs no special checking or restructuring of data. It has no runtime impact at all -- it is information for the compiler only."

@DanielRosenwasser
Copy link
Member Author

Ping

@sandersn
Copy link
Member

👍

DanielRosenwasser added a commit that referenced this pull request Feb 16, 2016
Added a small section on type assertions.
@DanielRosenwasser DanielRosenwasser merged commit 5e9ac4f into master Feb 16, 2016
@DanielRosenwasser DanielRosenwasser deleted the typeAssertions branch February 16, 2016 22:35
@mhegazy
Copy link
Contributor

mhegazy commented Feb 17, 2016

I think this deserves a page by itself.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants