kurtlawrence / papyrus

(Rust) repl
MIT License
439 stars 14 forks source link

Only accept &mut data #22

Closed kurtlawrence closed 5 years ago

kurtlawrence commented 5 years ago

Problem

  1. Three linking variants are frustrating to manage.
  2. They provide little added value.
  3. Mutating on eval stage will stack, same mutation is undertaken on every eval stage.

Scope

Reasoning

Having the ability to take three different reference types was initially a good idea. It became apparent however that typing the reference method was unnecessary. The borrow lifetime would always be just the eval function, and if using eval_async then relevant reference counters are required anyway.

The stacking mutation were also buggy, it goes against what would be expected of the repl. Only providing a immutable reference will stop this. A mechanism will have to be developed that allows a mutation to occur, and occur only once...