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.
[ Parent
| on HN ]
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.