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

Use a NoRule sentinel type instead of Nothing? #25

Closed
nickrobinson251 opened this issue Aug 27, 2019 · 2 comments
Closed

Use a NoRule sentinel type instead of Nothing? #25

nickrobinson251 opened this issue Aug 27, 2019 · 2 comments

Comments

@nickrobinson251
Copy link
Contributor

Currently if we don't have a rule for something, we return nothing

I do think it is tempting to return nothing here... but I wonder if it is just more explicit to return a NoRule (/NotImplemented) sentinal type, like we already have DNE to distinguish the case when the derivative does not exist (#17). Thoughts?

@simeonschaub
Copy link
Member

It does seem consistent with methods from Base like findfirst though, but I don't have a very strong opinion either way

@nickrobinson251
Copy link
Contributor Author

nickrobinson251 commented Aug 27, 2019

Yeah, i feel like returning nothing make sense. And I'm not sure a custom sentinal would be better. But just raising it as a (small) user-friendliness question:

There are multiple cases where we don't return the derivative, for example, (1) it does exist, (2) it's not been implemented, (3) you're differentating wrt a function (#22)... probably others. And a maximum of one of these cases should return nothing (to disambiguate them).

Right now only case (2) returns nothing, so we're fine... but it does involve remembering the nothing means "no rule implemented". 🤷‍♂

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