I was looking at the implementation of
randstring when I saw something I didn’t quite understand.
function randstring end let b = UInt8['0':'9';'A':'Z';'a':'z'] global randstring randstring(r::AbstractRNG, chars=b, n::Integer=8) = String(rand(r, chars, n)) randstring(r::AbstractRNG, n::Integer) = randstring(r, b, n) randstring(chars=b, n::Integer=8) = randstring(GLOBAL_RNG, chars, n) randstring(n::Integer) = randstring(GLOBAL_RNG, b, n) end
What is the point of the “empty” function
function randstring end.
Why do we need to have
bin a local scope… dosn’t that mean after the
bis destroyed? What happens to the functions that depend on
So for example, when I call
randstring(10), it should dispatch
randstring(n::Integer) = randstring(GLOBAL_RNG, b, n) but
b is not in scope anymore since it’s defined in the global setting and is probably run at start of Julia, correct?