3 ms·
> As a result, Rust has a mechanism called “pinning” that indicates, in the type system, that a particular value will never move again, which can be used to imp
by cesarb 4y ago
> As a result, Rust has a mechanism called “pinning” that indicates, in the type system, that a particular value will never move again, which can be used to implement self-referential values and which is used in async. The details are beyond the scope of this blog post, [...]
What this otherwise excellent blog post neglects to mention is that "pinning" didn't exist in Rust as of its 1.0 release; it was only added much later, and IMO it's still very complex and hard to understand (which also explains why the author of this blog post glossed over it). It's a workaround for the fact that Rust moves are "just memcpy()" and therefore do not call any custom per-type code (which could be used to fixup any references after the move).
- thecodedmessage 4y agoThanks for the compliment! I wanted to go more into pinning, but this post was already extremely long (and many people have already complained about how long it is). So everything you said is very on-point, just covered by "the details are beyond the scope of this blog post." Would you mind putting this extra information as a comment on the article itself, so other readers in the future can have access?
- cesarb 4y agoUnfortunately, by "very complex and hard to understand" I also implicitly meant "[...] and I don't understand it myself well enough to explain it to someone else", sorry. I don't know whether it's because I haven't found a good enough explanation of that magic yet, or whether it's because it's something on the level of Haskell monads.