News for hackers. Stuff that matters.
Re:How JavaScript closures work under the hood by haberman on Sunday September 06, 2015 @11:27AM (#10177887)
Lua uses a concept called "upvalues" to refer to variables from enclosing scopes. The main observation here seems to be that you can statically determine a unique index for all local variables in any enclosing scope. I'm not sure exactly how the details work in cases where there are sibling scopes, but anyway it seems like a useful concept and i am surprised the concept/terminology is not more common.
Re:How JavaScript closures work under the hood by ScottBurson on Sunday September 06, 2015 @01:24PM (#10178289)
This technique is very old -- it goes back at least to Pascal, IIRC, and probably to Algol 60. It certainly was used in Scheme implementations in the late 1970s. I haven't heard the term "upvalue" before, though.
Re:How JavaScript closures work under the hood by haberman on Sunday September 06, 2015 @04:53PM (#10178964)
That's sort of my point. There seems to be some established knowledge about how you can address "upvalues" within closures but very little shared terminology or literature about it.
Re:How JavaScript closures work under the hood by rjeli on Sunday September 06, 2015 @05:13PM (#10179032)
Tcl uses uplevel to evaluate a block of code in the current context.