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

Explicitly declare decl_storage! getters as functions#3870

Merged
bkchr merged 5 commits intomasterfrom
rh-storage-fn-getter
Oct 22, 2019
Merged

Explicitly declare decl_storage! getters as functions#3870
bkchr merged 5 commits intomasterfrom
rh-storage-fn-getter

Conversation

@rphmeier
Copy link
Copy Markdown
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
Copy Markdown
Member

bkchr commented Oct 21, 2019

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

@rphmeier
Copy link
Copy Markdown
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
Copy Markdown
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