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] Remove StringRef from python binding functions #3775

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

Conversation

martinvuyk
Copy link
Contributor

Remove StringRef from python binding functions.

CC: @ConnorGray I'd also like to deprecate .unsafe_cstr_ptr() in PR #3638

@martinvuyk martinvuyk requested a review from a team as a code owner November 15, 2024 20:07
Signed-off-by: martinvuyk <[email protected]>
@JoeLoser JoeLoser requested a review from ConnorGray November 15, 2024 20:24
Copy link
Collaborator

@ConnorGray ConnorGray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Martin, thanks for tackling this! 🙂

Seeing all the places here where you needed to add an O: ImmutableOrigin parameter made me want to re-evaluate our current API design for StringSlice, to see if we can't avoid having to add so many new parameters (in this PR, and in existing usage of StringSlice).

I'm going play around with a couple design ideas, namely variations on removing the // from StringSlice so that the is_mutable parameter is no longer infer-only so that the mutability can be affixed directly as something like StringSlice[Immutable].

This is something we had before the language added infer-only parameters, but IMO in the case of is_mutable parameters, making them unspecifiable has this slight usability downside.

I'll report back here once that lands, and then see how it affects this PR and move forward with it 🙂

stdlib/src/collections/string.mojo Outdated Show resolved Hide resolved
stdlib/src/python/_cpython.mojo Show resolved Hide resolved
stdlib/src/python/_cpython.mojo Show resolved Hide resolved
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