Skip to content

Commit ddcd23e

Browse files
authored
revision: Weaken language in Contrarian update (#57)
1 parent 42adb33 commit ddcd23e

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

pages/blog/garbage-collection-is-contrarian.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -471,15 +471,11 @@ contrary!
471471

472472
This 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
483479
combination of a contravariant reference and a covariant reference of a proof
484480
value:
485481

@@ -493,10 +489,10 @@ The difference between the proven `gc-arena` solution based on invariance and my
493489
approach based on contravariant references (currently unsound/incomplete,
494490
requiring 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
502498
details) whereas the contravariant approach seems to give the "greatest lower

0 commit comments

Comments
 (0)