Skip to content

Commit c067ae6

Browse files
author
Ulrik Sverdrup
committed
reference: Move "unit" type to Tuple types
1 parent 69e47c7 commit c067ae6

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/doc/reference.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3383,17 +3383,10 @@ User-defined types have limited capabilities.
33833383

33843384
The primitive types are the following:
33853385

3386-
* The "unit" type `()`, having the single "unit" value `()` (occasionally called
3387-
"nil"). [^unittype]
33883386
* The boolean type `bool` with values `true` and `false`.
33893387
* The machine types.
33903388
* The machine-dependent integer and floating-point types.
33913389

3392-
[^unittype]: The "unit" value `()` is *not* a sentinel "null pointer" value for
3393-
reference variables; the "unit" type is the implicit return type from functions
3394-
otherwise lacking a return type, and can be used in other contexts (such as
3395-
message-sending or type-parametric code) as a zero-size type.]
3396-
33973390
#### Machine types
33983391

33993392
The machine types are the following:
@@ -3444,6 +3437,14 @@ of the tuple. It has no nominal name and is instead structurally typed.
34443437
Tuple types and values are denoted by listing the types or values of their
34453438
elements, respectively, in a parenthesized, comma-separated list.
34463439

3440+
The empty tuple is the "unit" type `()`, having the single value `()`
3441+
(occasionally called "nil"). [^unittype]
3442+
3443+
[^unittype]: The "unit" value `()` is *not* a sentinel "null pointer" value for
3444+
reference variables; the "unit" type is the implicit return type from functions
3445+
otherwise lacking a return type, and can be used in other contexts (such as
3446+
message-sending or type-parametric code) as a zero-size type.]
3447+
34473448
Because tuple elements don't have a name, they can only be accessed by
34483449
pattern-matching or by using `N` directly as a field to access the
34493450
`N`th element.

0 commit comments

Comments
 (0)