You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-13688 Require @derivative functions to have same access level as original declaration
Issue Description:
Implement anonymous func declarations.
Anonymous func declarations are useful for defining functions that intentionally cannot be referenced directly but that serve some other purpose.
Use cases:
// 1. `@dynamicReplacement(for:)`: dynamic replacement functions.dynamicfunc foo(_ x:Float)->Float{ x }@_dynamicReplacement(for: foo)func _(x:Float)->Float{ x +1}
// 2. `@derivative` and `@transpose`: derivative and transpose registration.// `func _` helps avoid exposing derivative and transpose functions as public APIs.publicfunc bar(_ x:Float)->Float{ x }// Publicly registered derivative. Derivative function itself is not exposed, however.@derivative(of: bar)publicfunc _(_ x:Float)->(value:Float, differential:(Float)->Float){(x,{ dx in dx })}// Publicly registered transpose. Transpose function itself is not exposed, however.@transpose(of: bar)publicfunc _(_ v:Float)->Float{ v }
Todo: pitch to Swift Evolution.
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: 3dc3cab5f8f6574b634f38be788d67e5
relates to:
@derivative
functions to have same access level as original declarationIssue Description:
Implement anonymous
func
declarations.Anonymous
func
declarations are useful for defining functions that intentionally cannot be referenced directly but that serve some other purpose.Use cases:
Todo: pitch to Swift Evolution.
The text was updated successfully, but these errors were encountered: