Skip to content

Conversation

@VitWW
Copy link

@VitWW VitWW commented Apr 28, 2023

This RFC proposes to add partiality to mutability to have partial mutable variables, including Partial mutable references.
This RFC is much simpler then Mixed mutable variables #3427

Rendered

let mut p1 : mut.%{x,y} Point = Point {x:1.0, y:2.0, was_x: 4.0, was_y: 5.0, state: 12.0};
	// p1 : mut.%{x,y} Point
let mut p2 : mut.%{x,was_x} Point = Point {x:1.0, y:2.0, was_x: 4.0, was_y: 5.0, state: 12.0};
	// p2 : mut.%{x,was_x} Point

let ref_p1 = &mut p1;
	// ref_p1 : &mut.%{x, y} Point
	
let refnr_p2 = &mut.%{x} p2;
	// refnr_p2 : &mut.%{x} Point

fn vz_restore (&mut p : &mut.%{was_x} Point2)  {
   *p.x = *p.was_x;
}

vz_restore(&mut p2);

pub fn mx_rstate(&mut p : &mix Point.%{mut x, state, %any}) { /* ... */ }
// mixed partiality of type and mutability

This is an extension to Partial Types Proposal #3426

@Lokathor
Copy link
Contributor

Generally the "pre-rfc" process (where you attempt to turn a partial idea into a full RFC) is done on the internals forum, https://internals.rust-lang.org/, or on the zulip, https://rust-lang.zulipchat.com/, rather than posting a draft PR.

@VitWW VitWW mentioned this pull request Apr 28, 2023
@VitWW
Copy link
Author

VitWW commented May 5, 2023

Partial Mutability will be part Partial Types (v3) Proposal, so I close this draft proposal.

Thanks to everyone read it!

@VitWW VitWW closed this May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants