Hello!
Suppose I have this simple example where I use the Parameters package:
using Parameters
@with_kw struct MyTest
a = 1
b = 2*a
end
Note how b is calculated based on a. If I write:
MyTest(a=4)
MyTest
a: Int64 4
b: Int64 8
Which is as expected. On the other hand if I write:
MyTest(b=5)
MyTest
a: Int64 1
b: Int64 5
In which case I have overwritten b = 2*a. Now in some instances this can be useful and so on, but my question is then:
Is it possible to in some way PROTECT a specific entry in a struct? To ensure that it cannot be set explicitly?
Or atleast output a warning; “WARNING: MyTest.b was set manually.”
Kind regards