Skip to content

Commit 79e178d

Browse files
authored
Update about.md
1 parent 8088331 commit 79e178d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

concepts/nothingness/about.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,12 @@ julia> filter(!isnan, [1, 2, NaN])
129129

130130
## Undefined data
131131

132-
This is not something you are ever likely to want, but there are ways to create composite types (such as [`struct`][struct]) with uninitialized fields.
133-
Julia usually tries to protect you by using default values, but can only do this if it has enough information to infer the field type.
132+
This is something you are likely use less frequently.
133+
Exceptions include:
134+
- There are ways to create composite types (such as [`struct`][struct]) with uninitialized fields.
135+
Julia usually tries to use default values, but can only do this if it has enough information to infer the field type.
136+
- In some cases, initializing a vector as `undef` can be a flexible and performant approach.
137+
This has been used, for example, in community solutions to the [Circular Buffer][circbuff] exercise (an advanced technique, but this is graded as a hard exercise).
134138

135139
Getting an [`undef`][undef] result from an attempt to access a value is an error state, typically flagged with an [`UndefRefError`][UndefRefError].
136140

@@ -147,3 +151,4 @@ Getting an [`undef`][undef] result from an attempt to access a value is an error
147151
[struct]: https://docs.julialang.org/en/v1/base/base/#struct
148152
[undef]: https://docs.julialang.org/en/v1/base/arrays/#Core.undef
149153
[UndefRefError]: https://docs.julialang.org/en/v1/base/base/#Core.UndefRefError
154+
[circbuff]: https://exercism.org/tracks/julia/exercises/circular-buffer

0 commit comments

Comments
 (0)