Closed freesig closed 2 weeks ago
the current implementation of pub vars expects that all pub vars are set.
Hmm I don't think there's a restriction anywhere. If a pub var
is not constraind, for example, a solution is allowed to set it to nil
. The only missing piece is being able to compare them to nil
so that's something we can add. But certainly we shouldn't require them to be set.
Currently the abi gen handles pub vars like state mutations but I think the current implementation of pub vars expects that all pub vars are set. Does this work?
I think we really need to pick a direction with pub vars. They are either like storage and can eventually support things like
map
and it's possible for them to be nil like storage (and we can check for nil). Or they are the same as vars and must all be set.I think the first option is much more powerful and fits the original intention for pub vars but currently it's very confusing being in this middle ground.
Users won't realize that they have to set all the pub vars because it's not a struct like vars are.