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

Problems with the DEFINED_DIFFRULES implementation #90

Open
KristofferC opened this issue Dec 29, 2022 · 0 comments
Open

Problems with the DEFINED_DIFFRULES implementation #90

KristofferC opened this issue Dec 29, 2022 · 0 comments

Comments

@KristofferC
Copy link
Contributor

Many "introspection" functions in DiffRules like DiffRules.diffrules look at the global variable DEFINED_DIFFRULES to collect information about what diff rules are defined. I think this has some issues:

  • Only diff rules defined inside DiffRules.jl will be inside DEFINED_DIFFRULES. Packages that use @define_diffule will not be in that list. That is because side effects like adding to a global variable are not visible when modified during the time a package gets precompiled. You would have to add stuff to it in __init__ for it to be visible.
  • Accesses are made with a symbol as an argument, for example, DiffRules.hasdiffrule(:Base, :sin, 1). This feels to me like it should be made with a module as first argument.

I encounter this when I try to make e.g. LogExpFunctions into an extension (which makes it a separate module). I'm trying to think of ways to improve this that are backwards compatible.

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

1 participant