-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the feature
Currently, attributes are simply a label that can accept a simple value: atribute: value, but this syntax is somewhat limited. My idea is that instead of using a simple label that can accept a simple value, we use a syntax similar to that for function calls: atribute(argument).
Use Case
The idea came up while reviewing PR #25480, a possible solution would be to use this new syntax to unify the deprecated attribute:
@[deprecated('use ultimate_fn instead', after: '2025-10-10')]
fn super_fn() {}
fn ultimate_fn() {}Proposed Solution
This new attribute syntax could behave just like a function call, allowing positional arguments as well as named arguments.
@[unsafe]
@[deprecated]
@[deprecated('use new module instead')]
@[deprecated(msg: 'use new module instead', after: '2025-10-10')]Attributes that do not take arguments may ignore ().
Also, the user (and even the compiler itself in the builtin module) could define attributes using the following syntax:
@[atribute]
fn deprecated(msg string, after string)Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
Version used
latest
Environment details (OS name and version, etc.)
all
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.