-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
References must keep track of their origin #470
Comments
The compiler now cathes this error properly. |
Or actually only the first one is caught (missed that there were a second one). So this will have to be fixed still... |
I think the second one requires the fixes I'm working on in the |
maybe data structures like Array should be able to take ownership (or have ownership automatically transferred to it when it has a reference to a variable that goes out of scope and would otherwise be deallocated) ? |
Currently, references can be invalidated by invalidating their origin inside their scope.
It is also possible to set references to point to values in a more short-lived scope:
Both of these can be prevented by checking the origin of a reference and whether the origin scope still exists; an error could be emitted if it doesn’t.
Cheers
The text was updated successfully, but these errors were encountered: