3 ms·
This is actually what we're doing in Vale. [0] Rust is a stellar language, and there's a lot we as a field can learn from it. Its borrow checker is pretty amaz
by verdagon 4y ago
This is actually what we're doing in Vale. [0]
Rust is a stellar language, and there's a lot we as a field can learn from it. Its borrow checker is pretty amazing for optimization, but it can be a detriment for a program's overall architecture, not to mention the difficult learning curve, which people tend to underestimate as an issue.
I want Rust to grow and succeed in the realms it's uniquely suited for, but I think we can make a general purpose programming language that combines its features in a new way and brings its strengths to the rest of the programming world.
For example, we found a way to recreate the borrow checker based on regions [1] on top of a foundation of shared mutability with reference counting (or generational references [2] in Vale's case).
Another example is inspired by Rust's RefCell; we found a way to decouple it from Rust's usual aliasability-xor-mutability rules to make it more flexible, in something we call Hybrid-Generational Memory. [3]
If we succeed, then we'll have found a way to get the borrow checker's benefits without its complexity. We're a little over halfway done with implementing the region borrow checker [4] and haven't broken ground on HGM yet, but we're well on our way.
Hopefully Vale will be the smaller, clearer language that's struggling to come out of Rust!
[0] https://vale.dev/ https://vale.dev/
[1] https://verdagon.dev/blog/zero-cost-refs-regions https://verdagon.dev/blog/zero-cost-refs-regions
[2] https://verdagon.dev/blog/generational-references https://verdagon.dev/blog/generational-references
[3] https://verdagon.dev/blog/hybrid-generational-memory https://verdagon.dev/blog/hybrid-generational-memory
[4] https://github.com/ValeLang/Vale/tree/master/Backend/src/region https://github.com/ValeLang/Vale/tree/master/Backend/src/reg...
- jollybean 4y agoThat is extremely cool, 'region locking' is something I've wondered about myself. Good luck.
- verdagon 4y agoThanks!
- avgcorrection 4y agoBig claims. Are all of these things as zero-cost as the things that Rust uses?
- verdagon 4y agoRust has some overhead for safety (bounds checking) and Vale will have some too (generation checking) but it's hard to say how much. If we get within even 2% of Rust, we'll call it a win for the simplicity we can bring to the programmer. Fingers crossed!
- amelius 4y agoHow efficient is this in a multithreaded environment? Can immutable data be accessed from multiple threads without much cost?
- verdagon 4y agoSimilar to Rust, each thread would have separate memory. Data would be lent or passed to other threads via channels, mutexes, or structured concurrency.
- amelius 4y agoWhat if you have a large map that represents an in-memory read-only database, and you wish to share its contents between different threads, where each thread can perform complicated queries? Would you need to duplicate it?
- jollybean 4y agoI can't speak for the author, but it would seem to me that some kind of mutex or whatever can be used in situations were you need them.