r/ProgrammingLanguages • u/FedericoBruzzone • May 21 '26
Mutable Value Semantics (MVS) or Ownership & Borrowing: A Trade-off Analysis
I'm continuing the research on semantics for a new language. After studying Mutable Value Semantics (MVS) in the first post (reddit discussion), I wrote a follow-up that examines the trade-offs between MVS and the Ownership & Borrowing model.
The post covers:
- Friction points in Rust's borrow checker
- Where Hylo's MVS solves them and where it introduces new trade-offs
- Swift's hybrid approach and its runtime exclusivity checks
- Open questions I'm exploring for my own language design
I'd love to hear your thoughts.
Link: https://federicobruzzone.github.io/posts/MVS-or-ownership&borrowing.html
21
Upvotes
View all comments
Show parent comment
3
u/RedCrafter_LP May 22 '26
The first few points about scalability I actually address in my comment.
The example with the if branch is not correct. This would create a union in the forwarding struct as a and b are mutually exclusive.
It is essentially a whole program escape analysis. But it's done in local steps. Each function defines it's forwards and each function call provides the requested storage. In most cases it's not really a complicated calculation. Only functions without heavy nested branching are potentially expensive and heavily overallocate. But such functions are bad practice anyway. Breaking things up in separate functions (which is good practice) reduces the explosion of cases and reduces calculation time.
Register pressure is a field of concern I didn't consider just yet. I have to see how this plays out. But realistically this feature wouldn't be used in every function. And every function that doesn't forward this particular local reference returned from a called function breaks the chain.
The entire system is entirely compile time lowered. At the end it will look just like my c example with a generated struct/union above the function.