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

[stdlib] Fix allow implicit casting MutableOrigin <-> ImmutableOrigin #3823

Open
wants to merge 4 commits into
base: nightly
Choose a base branch
from

Conversation

martinvuyk
Copy link
Contributor

@martinvuyk martinvuyk commented Nov 28, 2024

Fix allow implicit casting MutableOrigin <-> ImmutableOrigin by adding implicit constructors to and fro for Span and StringSlice

@martinvuyk martinvuyk requested a review from a team as a code owner November 28, 2024 20:48
Signed-off-by: martinvuyk <[email protected]>
Signed-off-by: martinvuyk <[email protected]>
@nmsmith
Copy link
Contributor

nmsmith commented Nov 29, 2024

Small note: If we end up modelling origin mutation as an effect that functions perform, rather than today's approach where structs and functions are parameterized by is_mutable parameters, this PR would end up being redundant, because "mutable slices" and "immutable slices" (etc.) would have the same type. (This idea has been in discussion for a while.)

That's not to say this PR shouldn't be accepted. Maybe this is solving some near-term problems that people have been experiencing. I'm out of the loop on this.

@martinvuyk
Copy link
Contributor Author

Hi @nmsmith, I would love for this PR to become redundant. Parametric origins are a pain. This is mostly to facilitate work in function signatures and at call-site to allow using both types interchangeably on both ends and letting implicit construction do the job of casting

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