@@ -471,15 +471,11 @@ contrary!
471471
472472This post received some excellent feedback / pushback on
473473[ Lobsters] ( https://lobste.rs/s/jydyuw/garbage_collected_handles_are_lifetime ) .
474- While I do not agree with what is, perhaps, the thrust of the feedback
475- ("contravariance has nothing to do with GC or self-reference" or in other words
476- that this entire approach is flawed), the following discussion did strongly
477- underline a meaningful point: a fully safe representation of unrooted handles is
478- possible as shown by [ ` gc-arena ` ] ( https://github.com/kyren/gc-arena ) and it
479- relies on _ invariance_ which can be viewed as a combination of covariance and
480- contravariance.
481-
482- In terms of contravariant references, this is exactly what I get with the
474+ That discussion brought up a great point that I had overlooked/forgotten: a
475+ fully safe representation of unrooted handles is possible as shown by
476+ [ ` gc-arena ` ] ( https://github.com/kyren/gc-arena ) and it relies on _ invariance_
477+ which can be viewed as a combination of covariance and contravariance. In terms
478+ of contravariant references, this is exactly (or close to) what I get with the
483479combination of a contravariant reference and a covariant reference of a proof
484480value:
485481
@@ -493,10 +489,10 @@ The difference between the proven `gc-arena` solution based on invariance and my
493489approach based on contravariant references (currently unsound/incomplete,
494490requiring runtime checks or new Rust features to make it safe) is, I believe
495491(again without proof), that the invariant approach gives the "least upper bound"
496- of the solution with a lot of limitations (basically, garbage collection must
497- happen outside of the interpreter's Rust call stack thereby forcing a stackless
498- interpreter design, and heap data cannot be accessed mutably even in a
499- single-threaded system; I recommend reading
492+ of the solution with strong limitations (garbage collection must happen outside
493+ of the interpreter's Rust call stack thereby forcing a stackless interpreter
494+ design, and heap data cannot be accessed mutably even in a single-threaded
495+ system; I recommend reading
500496[ this] ( https://kyju.org/blog/rust-safe-garbage-collection/ ) blog post and its
501497[ follow-up] ( https://kyju.org/blog/piccolo-a-stackless-lua-interpreter/ ) for more
502498details) whereas the contravariant approach seems to give the "greatest lower
0 commit comments