Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Explicitly declare decl_storage! getters as functions #3870

Merged
merged 5 commits into from
Oct 22, 2019

Conversation

rphmeier
Copy link
Contributor

This is a backwards-compatible (test included) convenience improvement for decl_storage!.

Instead of declaring a field as

MyField get(getter_name): ...;

we can declare as

MyField get(fn getter_name): ...;

This makes it clear that a function is being declared, and also means that searches for fn getter_name don't come up empty when reading code and looking for definitions. I also ported over all our SRML modules to follow this pattern.

@rphmeier rphmeier added the A0-please_review Pull request needs code review. label Oct 21, 2019
@rphmeier rphmeier changed the title Rh storage fn getter Explicitly declare decl_storage! getters as functions Oct 21, 2019
@bkchr
Copy link
Member

bkchr commented Oct 21, 2019

Could you please update the docs of the macro for this change?

@rphmeier
Copy link
Contributor Author

rphmeier commented Oct 22, 2019

could you tell me which docs you mean? i did another pass, but I had already gotten through srml-support/procedural. There aren't any other obvious docs.

Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

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

Good stuff! The plan is to stay backward compatible or discard get(something) at some point?

@bkchr bkchr merged commit 0b97294 into master Oct 22, 2019
@bkchr bkchr deleted the rh-storage-fn-getter branch October 22, 2019 07:54
alfredgit220 pushed a commit to alfredgit220/darwinia that referenced this pull request Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants