Ah, that makes more sense now. Thanks. s
On Monday, 8 December 2014 18:16:48 UTC, Jeff Bezanson wrote: > > This is not a behavior of `begin` blocks but of top-level expressions. > Each top-level expression is wrapped in a "soft scope" that can have > its own locals but allows globals to leak in: > > julia> a = 0 > 0 > > julia> begin > local x = 1 > a = 2 > end > 2 > > julia> a > 2 > > julia> x > ERROR: x not defined > > On Mon, Dec 8, 2014 at 12:02 PM, Simon Byrne <[email protected] > <javascript:>> wrote: > > So begin blocks can introduce a scope, they just don't by default? > > > > In your `local t = 1; t` example: what, then, is the scope of t? > > > > > > On Monday, 8 December 2014 16:56:24 UTC, Isaiah wrote: > >> > >> tmp is declared local to the begin blocks > >> if that sounds odd (it did to me at first), try typing `local t = 1; > t`) > >> > >> On Mon, Dec 8, 2014 at 6:11 AM, Simon Byrne <[email protected]> > wrote: > >>> > >>> According to the docs, begin blocks do not introduce new scope blocks. > >>> But this block: > >>> > >>> > >>> > https://github.com/JuliaLang/julia/blob/1b9041ce2919f2976ec726372b49201c887398d7/base/string.jl#L1601-L1618 > > >>> > >>> does seem to introduce a new scope (i.e. if I type Base.tmp at the > REPL, > >>> I get an error). What am I missing here? > >>> > >>> Simon > >> > >> > > >
