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

RFC: Mixed mutable variables #3427

Closed
wants to merge 2 commits into from

Conversation

VitWW
Copy link

@VitWW VitWW commented Apr 28, 2023

This RFC proposes Mixed mutable variables, including Mixed mutable references.

Rendered

struct Point2 {x : f32, was_x : f32}

let mut p1 : Point2 = Point2 {x:1.0, was_x:2.0};

fn pntm_store (&^type p : & ^{^const x, ^mut was_x} Point2)  {
   *p.was_x = *p.x;
}

pntm_store(&^arg p1); // effective mutable reference

let ^type p2 : ^{^mut x, ^const was_x} Point2 = Point {x:1.0, was_x: 4.0};
	
let ref_p2 = &^max p2; // mixed mutable reference

This is an extension to Partial Types Proposal #3426

@ehuss ehuss added the T-types Relevant to the types team, which will review and decide on the RFC. label Apr 28, 2023
@VitWW
Copy link
Author

VitWW commented Apr 28, 2023

As I see, Partial Mutability is a better choice then Mixed mutable variables, so I close this draft proposal.

Thanks to everyone read it!

@VitWW VitWW closed this Apr 28, 2023
@VitWW VitWW mentioned this pull request Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-types Relevant to the types team, which will review and decide on the RFC.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants