effekt-lang / effekt-lang/effekt
Overloaded local mutable variables
- Dominant language
- Scala
- Stars
- 469
- Forks
- 41
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 23
Description
In our System C implementation, we have builtin support for [local regions](https://se-tuebingen.github.io/oopsla-2022-artifact/casestudies/regions.html):
```
region r {
var x in r = 1;
val closure = box { () => x };
()
}
```
As a next step (in System C or Effekt), we could allow users to overload `var` as follows:
```
effect Variable[T] { def get(): T; def set(value: T): Unit }
def state[R, S](init: Int) { prog: {Variable[S]) => R }: R
def user() {
var x in state = 4;
... x = x + x
}
```
will be desugared to
```
def user() {
state(4) { {x} =>
... x.set(x.get() + x.get()) ...
}
}
```
(I think I have seen something like this in Kotlin)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.