File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 11# DynamicObjects.jl
22
3- Provides an ` @dynamicstruct ` macro, allowing quickly defining structs with cached properties.
3+ Provides an ` @dynamicstruct ` macro, allowing quickly defining structs with derived (and optionally cached) properties,
4+ which can be defined inline using ` prop = expr ` using all previously or afterwards defined fields and properties, e.g. as
5+
6+ ``` julia
7+ using DynamicObjects
8+
9+ @dynamicstruct struct MyStruct
10+ " Standard fields are defined without an `=` sign. These can have types."
11+ a:: Float64
12+ " Derived properties can use any of the other fields or properties (provided there are no cycles)."
13+ b = a + 1
14+ " Derived properties can be cached."
15+ @cached d = c + 1
16+ " Order of definition does not matter"
17+ c = b + 1
18+ " Derived properties get computed lazily and then get stored locally."
19+ e = d + 1
20+ end
21+ ```
22+
423See [ https://nsiccha.github.io/DynamicObjects.jl ] ( https://nsiccha.github.io/DynamicObjects.jl ) for a non-minimal example.
You can’t perform that action at this time.
0 commit comments