Custom decorator
I am currently working on a custom mojo library, and i tried to implement a custom decorator so I could write less code. But while compilation an error ocurred, so I would like to ask:
Is it possible to implement custom decorators in Mojo and if yes, what is the syntax for that ?
Example Code (The code in my project is too long to mention here):
5 Replies
I think custom decorators are currently not supported (from github issues) https://github.com/modularml/mojo/discussions/216#discussioncomment-5956295
GitHub
Create a new decorator · modularml mojo · Discussion #216
What's not working? # create my hello decorator fn my_hello_decorator(func): fn wrapper(): print("Hello,") func() print("Bye Bye!") return wrapper # use my hello decorator @...
@a2svior Thank you!
I'd like to see custom decorators myself though, let's upvote this issue
Me too, lets do it.
Congrats @Joel, you just advanced to level 2!