enlightware / enlightware/ferlium

Long-lived projections

Open
#164 3 comments 0 reactions 0 assignees View on GitHub
longer term maybe type
Dominant language
Rust
Stars
14
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Currently, a projection is required to be consumed in the same expression as the subscript we called was. This is fine, and it's similar to what Swift is doing. However, we can extend this notion like Hylo to long-lived projections:

```ferlium
let mut xs = [1, 2, 3];
let x: &mut int = xs[0]; // project out a part from xs - xs becomes temporarily inactive

x += 2; // last use

print(xs); // now xs is available again
// [3, 2, 3]
```

I suspect this requires significant additional complexity in the compiler, but it might be worth it depending on the appetite of the language. What do you think?

Contributor guide

Open the contributing guide

Research direction

The issue provides a language-design example for long-lived projections but names no files, tests, or compiler entry points. Research would need to identify the projection and borrow-checking implementation first; the desired result is that a projection remains usable until its last use and then makes the original value available again.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.