mna / agora

a dynamically typed, garbage collected, embeddable programming language built with Go
https://github.com/mna/agora/wiki
BSD 3-Clause "New" or "Revised" License
324 stars 27 forks source link

Better upvalue management in closures #26

Open mna opened 10 years ago

mna commented 10 years ago

Right now closures are "dumb", each function value keeps a reference to its whole environment recursively up until the module function. This makes closures easy to implement, but it keeps alive all values, regardless of whether or not they are actually used in the closure.

For better memory management, analyze the required values and keep only what's required.