-
Notifications
You must be signed in to change notification settings - Fork 200
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
Add extra attributes to functions and structs #5874
Labels
enhancement
New feature or request
Comments
5 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Sep 5, 2024
# Description ## Problem Part of #5874 ## Summary This is fun 😄 ![fn-add-attribute](https://github.com/user-attachments/assets/3fa5bf97-b7f1-4c85-8c54-4198ee35efeb) ## Additional Context I'll add similar methods to `StructDefinition` and `Module` in follow-up PRs. ## Documentation\* Check one: - [ ] No documentation needed. - [x] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
5 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Sep 5, 2024
…#5945) # Description ## Problem Resolves #5874 ## Summary ## Additional Context I originally wanted to test this by adding `abi(...)` to a struct and seeing that it errors if that struct appears in a signature but is outside of a contract, but... function parameters are type-checked before that (I think). So another way to test this is to also have `has_named_attribute`, so I added that too. Side note: maybe adding an attribute to a function/struct should eventually invoke the associated function, if there's any, but we can probably try to do that in a separate PR, and only if really needed. ## Documentation Check one: - [ ] No documentation needed. - [x] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Feature request comes from a slack request.
There is no way to add new attributes to functions or structs while metaprogramming
Happy Case
We could add the functions:
The example given to me was to add
#[abi(tag)]
or#[recursive]
.Using strings is a bit awkward here but attributes internally remain as strings until they're later parsed so using Quoted would also be awkward. Using just strings prevents users from quoting/unquoting code to create these attributes though.
Workaround
None
Workaround Description
No response
Additional Context
No response
Project Impact
None
Blocker Context
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: