On Sunday, February 9, 2014 2:52:01 PM UTC-8, Jeff Bezanson wrote: > > Global variables (modules) operate very differently from local > variables. That is the big split.
Sure, much like Python. I just want to be able to get my hands on the inner scope blocks. > eval() only operates at the top level. The top level, or the current innermost enclosing module level? If the latter, I guess I can achieve what I need by creating a new module with a gensym'd name and eval'ing my code inside of that. > Types are not really scopes at all, just data structures. Sorry, I meant the scope block introduced by a type block. > The difference is that a variable reference (just "x" or "x=y") will never > refer to anything inside a type or object. > > On Sun, Feb 9, 2014 at 5:34 PM, Bill Janssen > <[email protected]<javascript:>> > wrote: > > I'm still struggling with understanding Julia's scopes. Are they > > consistent? Why does the following happen? I'd expect "y" to be > lexically > > bound by the let. This is version 0.2. > > > > julia> let y = 4; eval(symbol("y")); end > > ERROR: y not defined > > > > In addition, one can refer to certain scopes (modules, types) with > functions > > such as isdefined(), but not to others (let scopes, for instance). Why > is > > that? > > >
