-
Notifications
You must be signed in to change notification settings - Fork 4
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
Support for decorators #131
Comments
couple thoughts
|
Thanks @nfultz. I know it's already taken for S4, but I think it would be still possible, since with S4, it's always within an expression as far as I know, e.g. |
Would you be ok with explaining this to someone not knowing Python and that doesn't know what decorators are? :) |
I think `@` is a primitive so it's a special case. I guess if `-` can have
a different meaning in prefix and infix form, there's no reason `@`
couldn't.
Another thought - R generally doesn't use significant whitespace like
Python does, so not clear to me how it could know to apply a decorator to
the next line.
@colin Fay - decorators are syntax sugar for applying higher order
functions. so instead of writing
```
a <- function(x) { ...}
a <- cache(a)
```
one would write
```
@cache
a <- function(x) { ... }
```
…On Fri, Jan 28, 2022 at 8:29 AM Lorenz Walthert ***@***.***> wrote:
Thanks @nfultz <https://github.com/nfultz>. I know it's already taken for
S4, but I think it would be still possible, since with S4, it's always
*within* an expression as far as I know, e.g. ***@***.***, and never @y, e.g. as
the first token on a line. Right?
—
Reply to this email directly, view it on GitHub
<#131 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADGGTWZHDYT5CHEAK5MM2LUYK777ANCNFSM5NBFHTBA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Potential related to this, is https://github.com/dirkschumacher/defmacro. It might provide a way to declare these this using R syntax. |
For example like in Python. This would allow things like
The text was updated successfully, but these errors were encountered: