News for hackers. Stuff that matters.
Re:Lisp Machine Manual (1984) by kazinator on Thursday September 07, 2017 @11:01PM (#15197607)
Hash consing will break if conses have to be mutated, or if their identity has to be attributed with data specific to the circumstances of their creation (such as attributing expressions read from files with file and line number information).

AnimalMuppet is basically right. Normal, everyday Lisp code does quite casually allocate memory: more or less of it depending on circumstances.

Implicit dynamic memory allocation occurs in places where in the analogous circumstances in C it wouldn't occur.

The abstract semantics of Lisp (such as ANSI CL) call for dynamic allocation of all lexical variable bindings, because in the abstract semantics, these have indefinite extent.

Each time a lexical scope with variables is entered, dynamic allocation takes place to create the fresh bindings, which enables continued access to these bindings after that scope's evaluation terminates.

Such allocation is only avoided as a matter of optimization: the Lisp compiler analyzes the scope to determine that no escaping closures are created in it and then the bindings can be allocated stackwise (dynamic extent) similarly to C's automatic storage.

Nothing in ANSI CL guarantees to you that (let (x)) will not allocate a piece of memory for x which endures after the form terminates, and has to be reclaimed.

There are no comments on this comment yet.