Specific options_set behavior if already exist value.
sonder-joker opened this issue · 4 comments
I not found defined options_set
behavior if already exist value. May we should specific the behavior?
Worth documenting indeed!
Overwriting the previous value seems like the most intuitive behavior. What do you think?
Yes! options
support reuse, so overwrite is a good choice to save resources.
But also an alternative way is add a new function support try_set
, it will set options if not exist or return exist_key
error code if already set. Whether new functions need to be added depend on whether the situation is common.
Before that, we can specify the behavior of option_set
will overwrite.
Alright, let's document the overwriting behavior and wait for actual try_set
use cases before adding it :)
Thank you!