Closed jariji closed 8 months ago
Unlike rand
(where the hidden state is always assumed to exist), the currently used test case does not always exist, so the bang serves as a reminder that there is some (hidden) state being modified when this is called. I'm feeling a bit uneasy about removing the bang there (and similarly with target!
and reject!
too) because of that.
It's a bit like Random.seed!()
, which seeds a (hidden) default.
I like having a simple rule with a specific universal documented meaning so authors can use it to communicate properties of a function simply and precisely to their users. Unfortunately the current "convention" doesn't follow the rule quoted above; it's subjective, as seen in idiosyncrasies like rand(rng)
, print(::IOBuffer)
, and seed!(k)
, which makes it hard to use for precise communication between individuals.
Anyway that's just my personal rant, not your problem. Feel free to close this if you like.
I'll do a small export-audit of everything that I consider API before registering, so I'll take a look at this then.
Alright, I've reworked the exposed API. Everything now consistently uses <verb>!
from the user-side, to indicate the change of hidden state. I've also modified the internal uses to follow the usual convention.
https://docs.julialang.org/en/v1/manual/style-guide/#bang-convention gives the convention
Since
assume!(::Bool)
doesn't modify its arguments I suspect it should beassume(::Bool)
.