-
Notifications
You must be signed in to change notification settings - Fork 2.7k
decl_module!
allow procedural macro to work on calls function
#2782
Comments
Do you have any procedural macro in your mind that would be helpful? |
I was thinking of custom attribute macros which can check a condition or execute some common logic before a function executes. For example - access control, logging, etc. Also, to @thiolliere's point, the cons are reasonable, but I believe, it should be left to the runtime developer to choose if they want the default functionality (no additional macro) or a customized one. At the moment, there seems to be no choice. |
This will be fixed by #6877 Basically the macro does it take information from the dispatchables implement block but doesn't touch other attribute macro. Thus other macro can expand and modify the inner content of the dispatchables after the pallet macro attribute has read its information and expanded its stuff (elsewhere, it doesn't touch the implement block). For instance transactional annotation is supported without any change in the pallet attribute macro. Though what is not expanded is a macro which would modify the signature of the dispatchable. |
So if someone need to execute a macro prior to Maybe we provide a macro helper to execute some macro defined inside a macro: execute_foo! {
#[pallet]
mod pallet {
....
foo!{ ... }
} So execute_foo would search for keyword If ppl have strong need for it then I can try to come up with something. |
Currently we only provide doc attribute for dispatchable call.
But some module maker could want to add more logic make use of procedural macros.
Would it be interesting to allow this users to make use of regular attribute ?
Pros:
Cons:
Ok(())
for instance.Finally I feel not in favor of it considering the potential complexity it brings in regards to backward compatibility and APIs.
@gautamdhameja
@bkchr ?
The text was updated successfully, but these errors were encountered: