Algebraic effects, ownership, and borrowing
antelang.org
antelang.org
Getting rid of explicit lifetime variables is also an interesting choice within this design space.
Shared references can be problematic in a single threaded context too. (You may well be aware of this, but posting for the benefit of anyone who isn't.) This blog post has a good summary of the problematic cases: https://manishearth.github.io/blog/2015/05/17/the-problem-wi...
If anyone's curious, here's how ante addresses these issues:
- It causes memory unsafety: Ante's `shared` references prevent memory unsafety by preventing projecting them into "shape-unstable" types like a vector's element
- Iterator invalidation: This is the previous point in disguise. Since iterating over a shared vector would grab references to its elements - this is prevented since it is shape-unstable. You'd need to clone the elements.
- It's effectively threaded: This is the same bug yet again! Once shared-ness is tracked this becomes a non-issue. Ante is still able to have the static guarantee that this can't happen but does not need to prevent sharing to do so.
- Safe Abstractions: This section is a bit general but it's worth noting Ante still has the ability to have `&own mut t` references if needed. The `swap` function there could use them for example.
Overall the claim that "Aliasing that doesn’t fit the RWLock pattern is dangerous" is fairly rust-centric. It would be dangerous if you had no other restrictions, but we could also adopt different restrictions that still permit aliasing but disallow projection into shape-unstable types instead.
let mut my_tuple = (1, 2);
let first_elem = &my_tuple.0;
// error[E0506]: cannot assign to `my_tuple` because it is borrowed
my_tuple = (3, 4);
println!("{first_elem}");
In that specific example it isn't a problem because the type being changed is just an integer. But if you tweak it slightly it creates a use-after-free: let mut my_tuple = (vec![1, 2, 3], 56);
let first_elem = my_tuple.0.as_slice();
my_tuple = (vec![4, 5, 6], 23);
println!("{first_elem:?}");
In this case `first_elem` is a `&[i32]`, and when `my_tuple` is reassigned the allocation is freed while the reference still exists.> A low-level functional language for exploring algebraic effects, safe shared mutability, and other novel features
Eg: (after a quick googgle) there is "Concordian economics" nominally an "integration of theory, policy, and practice" which borrows the algebraic rule terms commutative, distributive, and associative.
There's nothing wrong in principal (practice and|or reality are other things) with positing that concepts like transfers of ownership and goods should follow some set of rules .. that is what abstract algebra is all about, { groups of things, sets of rules }.
I have no knowledge of whether this is mainstream or very fringe .. but it's a thing <shrug>.
The language does have a basic language server already though! It currently supports inline diagnostics and hover to show type.