Skip to content
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

Rules for unary functions, alway return tuple? #31

Closed
willtebbutt opened this issue Aug 23, 2019 · 4 comments
Closed

Rules for unary functions, alway return tuple? #31

willtebbutt opened this issue Aug 23, 2019 · 4 comments

Comments

@willtebbutt
Copy link
Member

They currently return the rule, as opposed to a 1-tuple where the only element is the rule. This is inconsistent with n-ary functions, which return a tuple of rules, and makes writing code annoying. What would people's feelings towards changing this convention such that unary functions do in fact return a tuple of rules be?

@oxinabox
Copy link
Member

Everything will have to be a tuple once we start including the function itself

@willtebbutt
Copy link
Member Author

willtebbutt commented Aug 24, 2019

Everything will have to be a tuple once we start including the function itself

Not if the method in question doesn't any arguments :P

@oxinabox
Copy link
Member

Right, anyway, I think we should always so a tuple.

@oxinabox oxinabox changed the title Rules for unary functions Rules for unary functions, alway return tuple? Aug 27, 2019
@oxinabox oxinabox transferred this issue from JuliaDiff/ChainRules.jl Aug 27, 2019
@oxinabox
Copy link
Member

So AbstractRule actually always acts like it is a 1-tuple.
Because it overloads iterate and getindex.

But I don't love it at all.
Seems better to leave that kinda sugar to definition macros

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants