-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I am not sure this is a good idea, but filing it to have a central area for discussion.
The general idea is to have a mechanism available whereby mixing in or extending a particular class would auto apply some macros to the class that mixed it in or extended it.
This would eliminate the need for annotations in some cases, and enable frameworks to "hide" the macro applications from their users. Consider for instance:
class MyWidgetState extends State<MyWidget> with AutoListener {}Instead of:
@autoListen
class MyWidgetState extends State<MyWidget> {}Potentially frameworks could even add macro applications to their base classes (ie: State or Widget) in this example.
Pros
- Hides the magic in some cases
- Potentially less boilerplate
Cons
- Hides the magic, making it more magical, and less expected
- Two ways to do the same thing. Some macro authors may choose to use this just to avoid the annotation, making there two ways to do exactly the same thing.
- Potential overhead in more complicated class hierarchies that otherwise aren't necessary (if the mixin is only used to apply the macro for instance)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request