sway icon indicating copy to clipboard operation
sway copied to clipboard

Rename storage access methods

Open IGI-111 opened this issue 2 years ago • 3 comments

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 avatar Jul 04 '23 12:07 IGI-111

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).

Agilulfe avatar Jul 05 '23 18:07 Agilulfe

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

IGI-111 avatar Jul 05 '23 20:07 IGI-111

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

Agilulfe avatar Jul 05 '23 20:07 Agilulfe