Despite having posted this myself, I’m interested in such a comparison, too. Though, I hadn’t heard of Carp until today. (That’s the right link, right? The author recommends RabbitVM instead.)
PicoLisp has a single data type internally, and as a result doesn’t do anything fancy in terms of garbage collection (there’s no real avenue for heap fragmentation). As such it’s just a mark-sweep collector.
newlispdoes do something more fancy, Automatic Memory Management in newLISP, which is similar in nature to what Interim does, and what Rust does as well, albeit in a completely different way.
newLISP follows a one reference only (ORO) rule. Every memory object not referenced by a symbol is obsolete once newLISP reaches a higher evaluation level during expression evaluation. Objects in newLISP (excluding symbols and contexts) are passed by value copy to other user-defined functions. As a result, each newLISP object only requires one reference.
newLISP memory management in practice felt like Tcl to me, and not in a good way. The details are different, but you end up doing similar kluges, where you pass a handle to data that must be manually GC’d if you need to pass large stuff around/mutate data. That’s radically different from what Rust does, both in broad strokes and in the details.
[Edit: accidentally wrote PicoLisp the first time I drafted this comment.]
Yes, Rust is undoubtedly better in practice, though far more complicated to learn, and implement (from a compiler standpoint). A couple of hacks here and there and you get “arena-like” allocation properties, and it’s easy to implement? Yeah, seems like a good trade off for small, embeddable languages, to me.
Oops! There’s some naming conflict there. I’m the author of the Carp and Rabbit you mentioned, both of which are small learning projects. https://github.com/carp-lang/Carp is probably the Lisp you are looking for.
I can’t help but think that capabilities would be a great solution to managing memory (as well as other properties). Pony uses capabilities to guard against race conditions (it’s a concurrent language), but I’d love to see the same concepts applied to memory regions and their ownership.
I believe that was the original use of capabilities in hardware. See Capability-based, Computer Systems. In type systems, Amal Ahmed made linear types more useful by combining them with capabilities. Also found something maybe worth a submission in near future despite being old. Another Lobster tipped me off a while back on phantom types being used for something similar to Ahmed’s work. Just found this that might illustrate possibilities.
The JaneStreet example is very clear, and I can see how it would be possible to write the equivalent of Pony’s capabilities in OCaml, at the cost of a less expressive syntax, but with the great benefit of being able to define a custom capabilities algebra. Thanks for the references, as always!
To be honest, this isn’t really lisp related - authors are just using sexp syntax to show region based memory management technique.
Ok, I buy that. As I understand it, the majority of “tiny lisps” are not sufficient lisps. Should we drop the
lisptag?See this comment. Is PicoLisp lisp-related?
To me, proper Lisp needs to support repl, macros and treat function as first class values.
I would be very interested to see how this compares with say Carp. I’m not knowledgeable in this space though so it might be universes apart.
Despite having posted this myself, I’m interested in such a comparison, too. Though, I hadn’t heard of Carp until today. (That’s the right link, right? The author recommends RabbitVM instead.)
So, I’d like to see a comparison to PicoLisp.
This is Carp.
PicoLisp has a single data type internally, and as a result doesn’t do anything fancy in terms of garbage collection (there’s no real avenue for heap fragmentation). As such it’s just a mark-sweep collector.
newlisp does do something more fancy, Automatic Memory Management in newLISP, which is similar in nature to what Interim does, and what Rust does as well, albeit in a completely different way.
newLISP memory management in practice felt like Tcl to me, and not in a good way. The details are different, but you end up doing similar kluges, where you pass a handle to data that must be manually GC’d if you need to pass large stuff around/mutate data. That’s radically different from what Rust does, both in broad strokes and in the details.
[Edit: accidentally wrote PicoLisp the first time I drafted this comment.]
Yes, Rust is undoubtedly better in practice, though far more complicated to learn, and implement (from a compiler standpoint). A couple of hacks here and there and you get “arena-like” allocation properties, and it’s easy to implement? Yeah, seems like a good trade off for small, embeddable languages, to me.
Oops! There’s some naming conflict there. I’m the author of the Carp and Rabbit you mentioned, both of which are small learning projects. https://github.com/carp-lang/Carp is probably the Lisp you are looking for.
I can’t help but think that capabilities would be a great solution to managing memory (as well as other properties). Pony uses capabilities to guard against race conditions (it’s a concurrent language), but I’d love to see the same concepts applied to memory regions and their ownership.
I believe that was the original use of capabilities in hardware. See Capability-based, Computer Systems. In type systems, Amal Ahmed made linear types more useful by combining them with capabilities. Also found something maybe worth a submission in near future despite being old. Another Lobster tipped me off a while back on phantom types being used for something similar to Ahmed’s work. Just found this that might illustrate possibilities.
The JaneStreet example is very clear, and I can see how it would be possible to write the equivalent of Pony’s capabilities in OCaml, at the cost of a less expressive syntax, but with the great benefit of being able to define a custom capabilities algebra. Thanks for the references, as always!