4 ms·
I think the future is in languages that offer "opt-in" borrow checking, so you can use it where it makes sense. After all, most of a program should prefer simpl
by verdagon 4y ago
I think the future is in languages that offer "opt-in" borrow checking, so you can use it where it makes sense. After all, most of a program should prefer simplicity over performance, and only optimize where it matters. I think this is the path towards a more Pythonic Rust.
Some languages that are going this direction, including D [0] and Vale [1]. Vale's particular insight is that we can get the benefits of borrow checking with isolates (from Pony) and integrating "pure blocks" and pure functions into the type system, so to speak.
> ... breaks ownership is automatically transformed in a reference counted object ...
Some languages actually do this! Lobster [2] uses borrow-checker-like semantics and falls back on reference counting. And worth mentioning is HVM [3], which falls back to cloning.
[0] https://dlang.org/blog/2019/07/15/ownership-and-borrowing-in-d/ https://dlang.org/blog/2019/07/15/ownership-and-borrowing-in...
[1] https://verdagon.dev/blog/zero-cost-memory-safety-regions-part-1-immutable-borrowing https://verdagon.dev/blog/zero-cost-memory-safety-regions-pa...
[2] https://www.strlen.com/lobster/ https://www.strlen.com/lobster/
[3] https://github.com/HigherOrderCO/HVM https://github.com/HigherOrderCO/HVM
- cornholio 4y agoThanks for the link, Vale is promising and the "generational references" trick sounds neat. I'm not entirely sure how it impacts developer productivity (i.e. I use a refcount precisely because I don't want to manually manage memory; a cryptic, hard to reproduce runtime crash related to a "generation mismatch" is not much more helpful than a double free, "safety" guarantees that translate to runtime crashes are irrelevant in the real world except where they expose violation of the runtime invariants, such as access past the end of the array; but maybe I don't fully grasp the concept they are proposing). As a general sentiment, I fully agree that improving developer productivity while maintaining safety, speed and ahead of time compilation & static typing are open problems, and all current languages still suck more or less.