Skip to content

[Docs] [AutoDiff] Add default derivative subsection and fix minor issues. #28756

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

Merged
merged 7 commits into from
Dec 13, 2019

Conversation

rxwei
Copy link
Contributor

@rxwei rxwei commented Dec 12, 2019

  • Add section "Default derivatives", which documents what's discussed here.
  • .withoutDerivative() -> withoutDerivative(at:)
  • Fix syntax error in default derivatives.

Copy link
Contributor

@dan-zheng dan-zheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Though I'd recommend waiting for @marcrasi to review also.

Copy link

@marcrasi marcrasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good solution to me.

I have one question. What happens if a user defines a @derivative of a @differentiable(default) method?

@dan-zheng
Copy link
Contributor

I have one question. What happens if a user defines a @derivative of a @differentiable(default) method?

It seems to me that should be rejected: @derivative and @differentiable(default) are in conflict.

@rxwei
Copy link
Contributor Author

rxwei commented Dec 12, 2019

Looks like a good solution to me.

I have one question. What happens if a user defines a @derivative of a @differentiable(default) method?

I think this should be banned if it’s in the same module. Cross module should be allowed for flexibility, but can be banned in the initial proposal.

@rxwei
Copy link
Contributor Author

rxwei commented Dec 12, 2019

@swift-ci please smoke test and merge

@bartchr808
Copy link
Contributor

This:

I have one question. What happens if a user defines a @Derivative of a @differentiable(default) method?

Made me think about whether there would be any problems with dynamic lookup of functions, but as far as I can tell there aren't any weird cases.

@swift-ci swift-ci merged commit dcd164f into swiftlang:master Dec 13, 2019
@rxwei
Copy link
Contributor Author

rxwei commented Dec 13, 2019

That should be orthogonal, as statically the only thing involved is subscript(dynamicMember:). Derivative registration only cares about member declarations in terms of static lookup.

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

Successfully merging this pull request may close these issues.

5 participants