rust-hosted-langs / book

Writing Interpreters in Rust: a Guide
https://rust-hosted-langs.github.io/book/
Creative Commons Attribution 4.0 International
479 stars 27 forks source link

In implementation of Array, replace Cell<RawArray> with RefCell #37

Open pliniker opened 4 years ago

pliniker commented 4 years ago

Originally, Array didn't have runtime-borrow capability and I made the (hasty) decision to base the Array struct on using Cell<RawArray<T>>.

It is clear that it makes far more sense to use RefCell now, both from a semantic and performance basis. The explicit borrowflag can also be removed.

Source: interpreter/src/array.rs:42 Book: booksrc/chapter-interp-arrays.md