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

[Observation] Add generation for _modify to fields such that we avoid extra CoW #71122

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

phausler
Copy link
Contributor

This changes the emission of the @Observable macro such that the field generation has an additional _modify accessor. Doing this avoids the potentially quadratic access for collection types and does in-place mutation. Provisionally this seems to have no adverse behavioral impact with interoperation of existing observation systems.

Resolves the following issues:
rdar://121161889
FB13547947

@phausler
Copy link
Contributor Author

Tests for validation incoming soon.

@phausler phausler force-pushed the pr/observation_modify_access branch 2 times, most recently from 2868dd9 to 4ea8946 Compare January 25, 2024 00:13
@phausler
Copy link
Contributor Author

@swift-ci please test

@phausler phausler requested a review from a team as a code owner January 25, 2024 18:57
@phausler
Copy link
Contributor Author

@swift-ci please test

@phausler phausler merged commit ed23973 into swiftlang:main Jan 26, 2024
5 checks passed
carlos4242 pushed a commit to carlos4242/swift that referenced this pull request May 31, 2024
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