qupa-project / uniview-lang

View once immutability enabling the safeties of immutable code, while enjoying near procedural performance
https://uniview.qupa.org
MIT License
2 stars 0 forks source link

Lend System Rework: Multiple immutable lends #66

Open AjaniBilby opened 1 year ago

AjaniBilby commented 1 year ago

Currently there are only mutable lends, and constant arguments. When a cloned value is parsed to a functions' constant argument, the clone is nullified and a temporary immutable lend is silently produced for compiler internal use only.

This features should be exposed to allow greater reuse of values allowing more de-duplication opportunities.

A value should be able to be in three possible states. with two possible substates:

  1. Owned: Full access to the value
  2. Lent
    1. Immutable: Unable to access as the value is being used under another alias
    2. Mutable: Able to be read and able to produce additional mutable loans
  3. Borrowed
    1. Immutable: Only able to read, and produce immutable borrows from this borrow
    2. Mutable: Full access except for drop
AjaniBilby commented 1 year ago

These changes will nullify issue #58