News for hackers. Stuff that matters.
Re:NewLisp by life_is_short on Thursday October 06, 2016 @11:58PM (#12658055)
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

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?

Re:NewLisp by hilti on Friday October 07, 2016 @02:27AM (#12658626)
This 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.

Re:NewLisp by david-given on Friday October 07, 2016 @05:18AM (#12659217)
A 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?

Re:NewLisp by astrobe_ on Friday October 07, 2016 @07:02AM (#12659659)
For 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.

Re:NewLisp by david-given on Friday October 07, 2016 @02:20PM (#12662761)
From Wikipedia:

> Sharing of sub-objects among objects, cyclic structures, or multiple variables pointing to the same object are not supported in newLISP.

Dang.