Skip to content
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

convenience: do shared borrow in same line as a linear pass #8

Open
tjhance opened this issue Dec 2, 2020 · 0 comments
Open

convenience: do shared borrow in same line as a linear pass #8

tjhance opened this issue Dec 2, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@tjhance
Copy link
Collaborator

tjhance commented Dec 2, 2020

It would be nice to be able to do this:

datatype X = X(x: int)
method bar(x: int, linear a: X)
method foo(linear a: X)
{
  bar(a.x, a);
}

Right now we have to do this instead:

datatype X = X(x: int)
method bar(x: int, linear a: X)
method foo(linear a: X)
{
  var x := a.x;
  bar(x, a);
}

Note that fixing this requires being cognizant of evaluation order, for example, if we do bar(some_linear_function(a), a.x) then either: (i) this should be disallowed or (ii) the compiler must make sure a.x is evaluated before some_linear_function(a).

@parno parno added the enhancement New feature or request label Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants