4 ms·
In NewLisp's memory management model, I didn't understand if one-reference-only limits what the programmer can do. http://www.newlisp.org/MemoryManagement.html
by life_is_short 10y ago
In NewLisp's memory management model, I didn't understand if one-reference-only limits what the programmer can do. http://www.newlisp.org/MemoryManagement.html http://www.newlisp.org/MemoryManagement.html
Does it mean it's impossible for more than one variable to refer to a variable already referenced? If yes, is this a problem in practice? If no, is this the way of the future?
- hilti 10y agoThis comes up every time newLISP is introduced somewhere. I'm not a developer who ever tried to create or invent a new language, so my knowledge is really limited regarding which memory management is advanced or dumb. BUT I've used newLISP in many web business applications, which are still used by hundreds of users, under load and I've never ran into trouble. Developing and coding such big projects has been great (we used newLISP contexts a lot). I'm trying to say: in practice I don't care about internal memeory management if the language does it job. And in my opinion newLISP is a good tool to solve real world problems.
- david-given 10y agoA brief skim of the document suggests: - single-reference-only for expressions (so, static object lifetime); deletion is delayed until a stack slot gets reused, allowing return values - assignment to variables or values passed into functions are done by copy - EXCEPT certain types are passed into functions by reference as an optimisation So, basically, values are owned by either the stack or a variable. Assignment to a stack cell destroys what was there before. To keep a stacked value, it needs to be copied into a variable. That all seems pretty intelligent, and I might steal the idea; except that I don't see any mention of how cyclic data structures or mutable data structures are implemented. Does anyone know how these are handled?
- astrobe_ 10y agoFor mutable structures you use the "context" concept, which is also used to build a form of OOP. For cyclic data structures, I'm not sure. I think one can pass a function, a list or a context to a function that expects a list. This it might do the trick.
- david-given 10y agoFrom Wikipedia: > Sharing of sub-objects among objects, cyclic structures, or multiple variables pointing to the same object are not supported in newLISP. Dang.