Hi, when I try to set a const field via reflection in a ctor I get an Err:
class Injector {
static Void main(Str[] args) {
i := Injectee {
// allowed
it.num = 69
// not allowed :: sys::ReadonlyErr: Cannot set const field wotever::Injectee.num
Injectee#num.set(it, 69)
}
}
}
class Injectee {
const Int num
new make(|This|in) { in(this) }
}
I see no reason why you should not be able to.
brianMon 1 Apr 2013
There is an internal flag used to keep track of if its safe to call setter. The best way to handle it to use Field.makeSetFunc
SlimerDude Sat 30 Mar 2013
Hi, when I try to set a const field via reflection in a ctor I get an Err:
I see no reason why you should not be able to.
brian Mon 1 Apr 2013
There is an internal flag used to keep track of if its safe to call setter. The best way to handle it to use
Field.makeSetFunc