kellysmith12.21
2020-9-15 01:41:29
Is there an idiomatic approach to smart constructors for structs, other than defining a function that wraps the original constructor?
sorawee
2020-9-15 01:51:26
How smart do you want it to be? struct
supports a very limited auto value, so if that suffices, you can use it.
There’s https://docs.racket-lang.org/struct-plus-plus/ if you need it to be more advanced .
kellysmith12.21
2020-9-15 01:54:40
Generally speaking, I’m thinking about constructors that verify invariants for fields and, perhaps, do some preprocessing before building the struct value.
kellysmith12.21
2020-9-15 01:56:14
However, in the case of what I’m currently working on, I just realized that smart constructors are not the right thing.