Ownership - Whiley/WhileyCompiler GitHub Wiki

Some relevant topics:

  • Memory managment
  • Resource Management
  • Transactions

Garbage Collection with Finalize

Simula, Java, C#, Go, JavaScript...

Linear/Affine types

Whiley has linear/affine typing like Rust. Pony has a slightly more expanded version of this scenario that prevents locking/deadlocks in a highly concurrent context, but uses GC for memory management (?).

C++ has unique_ptr, which is almost the same, but not checked by the compiler.

Reference Counting

Another form for ownership management is reference counting, either with a seperate refcount object like C++ shared_ptr/weak_ptr or an counter embedded in the object like Objective-C/Swift (who also have automatic reference count acquire/release injection).

Copy on Write References?

S-Expressions, functional languages like Lisp/Haskell.

But there are other variants that are possible. What about a copy_on_write_ptr? That is more difficult to achieve since you need to detect whether a method can modify an object and create a copy before modification takes place. Maybe static analysis can help here and inject copying code where appropriate.