JuliaDiff / JuliaDiff/DiffRules.jl

Problems with the `DEFINED_DIFFRULES` implementation

Open
#90 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
74
Forks
36
Avg merge
1d 1h
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the DEFINED_DIFFRULES implementation in DiffRules.jl and the introspection entry points DiffRules.diffrules and DiffRules.hasdiffrule. Investigate how @define_diffule behaves in separately precompiled packages and extensions; done means selecting and documenting a backwards-compatible design that handles external rules and module-based access.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
developer-experience
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.