I don't know about Linear Lisp, but if you do linear types as in Wadler's "Linear Types Can Change the World"[0] then the absence of the call to free would be a compilation error.
[0] https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.31...
[0] https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.31...
2. You can build abstractions that call free for you. The common withX callback-style function can be better typed with linear types and call free for you, for instance.
with-some-resource { res ->
// use res as you like
}
The with-some-resource function takes care of the resource management, while the type system takes care res doesn't escape the lambda.The original situation (malloc gives you a linear variable) handles what you want. A function that takes the variable but does not return it effectively "takes ownership of it" and the type system will force a free.
There's a "Linear Constraints" paper draft out there that emulates ownership and borrowing with linear types, and uses the titular new language feature to greatly improve ergonomics.