Skip to content

Instantly share code, notes, and snippets.

@dan-zheng
Last active January 4, 2020 19:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dan-zheng/0e28c41dd0734fa6d3644e6ed0a9c16f to your computer and use it in GitHub Desktop.
Save dan-zheng/0e28c41dd0734fa6d3644e6ed0a9c16f to your computer and use it in GitHub Desktop.
Retroactive derivative registration in Swift (https://bugs.swift.org/browse/TF-866)

Retroactive derivative registration: register derivatives for functions in other modules.

Previously:

  • If module A defines func foo, then its derivatives must be in the same module.

With retroactive derivative registration:

  • If module A defines func foo;
  • And if module B imports module A and defines @differentiating(foo) func derivativeFoo:
  • Then module C can import modules A and B and differentiate func foo (e.g. via differentiation APIs).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment