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

Rename storage access methods #4740

Open
IGI-111 opened this issue Jul 4, 2023 · 3 comments
Open

Rename storage access methods #4740

IGI-111 opened this issue Jul 4, 2023 · 3 comments
Labels
breaking May cause existing user code to break. Requires a minor or major release. compiler: ui Mostly compiler messages enhancement New feature or request good first issue Good for newcomers lib: std Standard library storage Anything related to how we treat the storage in Sway

Comments

@IGI-111
Copy link
Contributor

IGI-111 commented Jul 4, 2023

StorageKey's read and try_read are confusing, notably because of errors related to uninitialized storage.

try_read should be the default behavior and there should be extensive documentation of what happens with the storage initialization.

try_read should be renamed to read and read to read_unchecked, but this is a breaking and abrasive change, so we should consider a way of migrating the interface that doesn't startle the users.

@IGI-111 IGI-111 added enhancement New feature or request good first issue Good for newcomers lib: std Standard library breaking May cause existing user code to break. Requires a minor or major release. compiler: ui Mostly compiler messages labels Jul 4, 2023
@Agilulfe
Copy link

Agilulfe commented Jul 5, 2023

I could happily give it a go.

What about creating in a first place read_unchecked with the content of read in a first release so that there isn't any breaking changes and users can migrate softly. At the same time we could push some deprecation warnings on both try_read ("to be migrated to read in a further release") and read ("functionality was migrated to read_unchecked"). Then, in a further release, we will introduce the breaking changes with try_read --> read.

I think it's a bit more user-friendly (even though that kind of change is always problematic in any case).

@IGI-111
Copy link
Contributor Author

IGI-111 commented Jul 5, 2023

Yeah deprecation warnings sounds like a good way to do it.

@Agilulfe
Copy link

Agilulfe commented Jul 5, 2023

I am on it then. You can assign me to the issue

@anton-trunov anton-trunov added the storage Anything related to how we treat the storage in Sway label Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking May cause existing user code to break. Requires a minor or major release. compiler: ui Mostly compiler messages enhancement New feature or request good first issue Good for newcomers lib: std Standard library storage Anything related to how we treat the storage in Sway
Projects
None yet
Development

No branches or pull requests

3 participants