Lifetime Issues #11
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Current Implementation
Runs after type checking, before IR generation.
Ideas:
Solution: Ensures outlive relationship between LHS and RHS.
Solution: Only allow returning values that live forever.
Solution: Disallow returning exceptions that refer to mutable data.
Currently very buggy:
Long standing issue, fix is simple but is not yet fixed because global lifetime needs special handling.
Issue found today after reading the code. The lifetime of different parameters should be incomparable instead of the same, as they can come from different callers.
Also found today... This would also affects object with fields.
a
Lifetime: Global / Local (selected with if expression).b
Lifetime: Local.a
is considered as local.a.foo = b
is now legal asb
outlives local lifetime.The later 3 bugs probably require algorithmic changes, simple fixes are not sufficient.
Other Ideas
We probably want a sound system with less restrictive lifetime.