5 ms·
Cool to see explicit annotations for how to make rc fast when you have access to the ir. But doesn’t solve some major issues, like cycle collection: “ In pract
by djwatson24 6y ago
Cool to see explicit annotations for how to make rc fast when you have access to the ir. But doesn’t solve some major issues, like cycle collection:
“ In practice, mutable references are the main way to con- struct cyclic data. Since mutable references are uncommon in our setting, we leave the responsibility to the programmer to break cycles by explicitly clearing a reference cell that may be part of a cycle. ”
- studius 6y agoconst is really popular in JS... (i.e. could they surreptitiously be taking on Orinoco?)
- djwatson24 6y agoI don’t think const or non const is the main issue- some data structures just require cycles like graphs or circular linked lists.
- studius 6y agoI supposed you could construct as dynamic and then make it constant? I wonder why that feature isn't seen in common languages, even though I know it sounds crazy.
- vnorilo 6y agoClojure has transient mutable collections that are designed to become persistent once "complete". [1] Some systems have made use of using reference count of one (unique owner) as permission to mutate, something that TFA generalizes as memory reuse. 1: https://clojure.org/reference/transients https://clojure.org/reference/transients
- Jweb_Guru 6y agoI don't disagree, but I also suspect that a very large number of real world JavaScript applications have few to no application-induced cycles. I might even go further and say this extends beyond JavaScript--the most common reason I even define recursive data structures in a language like Rust is for AST-like data that almost invariably forms a tree.
- bjourne 6y agoAlways a catch with these zero-overhead refcounting schemes. If the programmer has to use some equivalent to weakrefs then how is this an improvement over existing schemes? The possibility of cyclic garbage to accumulate is a very big drawback in many applications.