Re: [julia-users] what scopes does isdefined() look in?

2014-02-17 Thread Bill Janssen
Yep. I'm impressed with the many elegant design choices in Julia. I'm just pointing out some rough edges with that convenience of "eval" that might be sanded off, and thinking about what changes I'd make for that. On Monday, February 10, 2014 7:50:48 PM UTC-8, Jeff Bezanson wrote: > > Building

Re: [julia-users] what scopes does isdefined() look in?

2014-02-10 Thread Jeff Bezanson
Building expressions and calling eval() and such are really just there as an escape hatch; you're not supposed to do lots of programming via eval(). If you look at the history of lisp, originally it was all about dynamic scope and building expressions, but it became clear that this was not an effic

Re: [julia-users] what scopes does isdefined() look in?

2014-02-10 Thread Stefan Karpinski
It's completely consistent – nothing ever reifies or reflects on local scopes. It just may not be what you're used to coming from Lisp or Scheme (or other dynamic languages). On Mon, Feb 10, 2014 at 3:10 PM, Bill Janssen wrote: > My concern is that there seem to be a lot of special-case things a

Re: [julia-users] what scopes does isdefined() look in?

2014-02-10 Thread Bill Janssen
My concern is that there seem to be a lot of special-case things about scoping and evaluation, which makes actual use of homoiconicity rather painful/difficult, and produces unexpected results for some classes of programs. Perhaps David Moon's idea of Contexts would address this. But they hav

Re: [julia-users] what scopes does isdefined() look in?

2014-02-09 Thread Kevin Squire
Rather than a rant, that sounded like a reasonable description of the relevant facts and issues! Either way, it would be useful in the FAQ. Cheers, Kevin On Sunday, February 9, 2014, Stefan Karpinski wrote: > On Sun, Feb 9, 2014 at 7:10 PM, Bill Janssen > > > wrote: > >> I just want to be ab

Re: [julia-users] what scopes does isdefined() look in?

2014-02-09 Thread Stefan Karpinski
On Sun, Feb 9, 2014 at 7:10 PM, Bill Janssen wrote: > I just want to be able to get my hands on the inner scope blocks. This you can't do, by design. When a dynamic language is implemented as a straightforward interpreter, local environments are just hash tables and it's so easy to expose them

Re: [julia-users] what scopes does isdefined() look in?

2014-02-09 Thread Bill Janssen
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 to

Re: [julia-users] what scopes does isdefined() look in?

2014-02-09 Thread Jeff Bezanson
Global variables (modules) operate very differently from local variables. That is the big split. eval() only operates at the top level. Types are not really scopes at all, just data structures. The difference is that a variable reference (just "x" or "x=y") will never refer to anything inside a typ

Re: [julia-users] what scopes does isdefined() look in?

2014-02-09 Thread Stefan Karpinski
In general, local scopes are not first-class in Julia. When you call eval, the code is executed in the current module's global scope and similarly, isdefined tells you whether a variable is defined in the current module's global scope. On Sun, Feb 9, 2014 at 5:34 PM, Bill Janssen wrote: > I'm s

[julia-users] what scopes does isdefined() look in?

2014-02-09 Thread Bill Janssen
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 (modul