-
Notifications
You must be signed in to change notification settings - Fork 371
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
Replace with-decorator
with decorator lists in defn
and defclass
#2270
Conversation
A possible extension would to make the brackets optional for the common case of only one decorator. However, |
Neat!! I'll take a look after work tonight. I do think we should keep the explicit brackets for single decorators. the ambiguity of which is the fn name doesn't seem worth the bracket saving two characters on the brackets. What is the evaluation order of multiple decorators using the new syntax? Python is right to left/bottom up. Is this the same way? |
It should be the same as Python's. I'll tweak a test to make it sensitive to the order in which decorators are called. |
And yes, the decorator expressions themselves are evaluated outer-first whereas the functions obtained by this evaluation are called inner-first, in both Python and this Hy implementation. Thus both of these programs print 1 through 4 in order:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! just needs documentation updated
Done. |
with-decorator
#1624I haven't updated the documentation yet.