So one thing I have considered is making for loops tail recursions. Unfortunately this only "solves" the non-problem for "for" loops, not when you use a goto.
Felix uses heap allocated "stack" frames for scopes, and a parent scope is referred to by a pointer. So within a child closure, you're always referring to the value of the parent at the point in time when you evaluate the reference. This is true for vals as well as vars: in fact a layed down val is the same as a var: its a C++ nonstatic member of a C++ class and vals can change value in a loop too. In fact they can be assigned in more than one place by the compiler as well: val x = if y then 1 else 2 endif is implemented by if (y) { x = 1; } else { x = 2; } You can't assign to a val or take its address .. but the compiler not only can, it must. So vals can have multiple assignments AND they're also mutable (in generated code). There's really no alternative to how it all works. A variable has to refer to its current value, even in a closure. The only question is when a new scope is formed, so there are multiple copies of the variable. -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language