Closed
Description
In http://doc.rust-lang.org/guide.html#tuple-structs-and-newtypes:
We call this a 'newtype,' because it lets you create a new type that's a synonym for another one
This might cause the reader to think that struct Foo(Bar)
creates type Foo
, which is a synonym for Bar
, and they can be used interchangeably, as with a type alias (or typedef in C).
This is not the case. A newtype declaration creates a distinct type, which cannot be used interchangeably with the type of its underlying representation. I think this should be clarified.
Metadata
Metadata
Assignees
Labels
No labels