Skip to content

Commit 8c8bd25

Browse files
authored
Update README.md
1 parent 71330a9 commit 8c8bd25

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ This will generate:
2424

2525
1. An immutable struct `S_Immut`;
2626
2. A mutable struct `S_Mut`;
27-
3. Constructors for `S` that can create either the mutable or immutable version.
27+
3. `const S = Union{S_Immut{Y}, S_Mut{Y}} where Y`.
2828

2929
It is then possible to create instances of the specified version:
3030

3131
```julia
32-
julia> s1 = S(1, 2, 3.0; mutable=true)
32+
julia> s1 = S_Mut(1, 2, 3.0)
3333
S_Mut{Int}(1, 2, 3.0)
3434

35-
julia> s2 = S(1, 2, 3.0; mutable=false)
35+
julia> s2 = S_Immut(1, 2, 3.0)
3636
S_Immut{Int}(1, 2.0, 3.0)
3737
```
3838

@@ -47,13 +47,8 @@ julia> @update s2.y = 3
4747
S_Immut{Int}(1, 3, 3.0)
4848
```
4949

50-
Importantly, there are some catches to keep in mind:
51-
52-
- The constructors are backed by a dummy struct of the same name (e.g `S` in the example above) which means
53-
that it would be incorrect to dispatch on it. Use one of the versions of the structs or the abstract type
54-
instead;
55-
- For an immutable type, the mutation actually involve the creation of a new instance with
56-
[Accessors.jl](https://github.com/JuliaObjects/Accessors.jl).
50+
Importantly, for an immutable type, the mutation actually involve the creation
51+
of a new instance with [Accessors.jl](https://github.com/JuliaObjects/Accessors.jl).
5752

5853

5954
## Contributing

0 commit comments

Comments
 (0)