-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[TF] Introduce callables. #24086
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
[TF] Introduce callables. #24086
Conversation
|
@swift-ci Please test tensorflow |
562a0f9 to
abeafa9
Compare
|
@swift-ci Please test tensorflow |
|
@swift-ci Please test tensorflow macOS |
Introduce callables: values that can be "called" like functions.
```
struct Adder {
var base: Int
call func(_ x: Int) -> Int {
return base + x
}
}
let add3 = Adder(base: 3)
add3(10) // 13
```
This is experimental functionality and highly subject to change:
the design will be updated based on feedback for SE-0253.
|
@swift-ci Please test tensorflow |
lattner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The patch looks generally great to me, thank you Dan. I appreciate that you switched the syntax to the likely result.
For the eventual final patch (not necessary in the 0.3 release) I think it would be better to model this as a normal FuncDecl with a special name. I don't think it is necessary to have a CallDecl node.
rxwei
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to change "call member" to "call function" or "call method" in diagnostics.
Yes, switching to a normal |
I believe this is already done, please let me know if you found places I missed. |
This reverts commit f7c7edf.
Introduce callables: values that can be "called" like functions.
```
struct Adder {
var base: Int
call func(_ x: Int) -> Int {
return base + x
}
}
let add3 = Adder(base: 3)
add3(10) // 13
```
This is experimental functionality and highly subject to change:
the design will be updated based on feedback for SE-0253.
* Revert "[TF] Introduce callables. (swiftlang#24086)" This reverts commit f7c7edf. * Revert "Fix `call` declaration serialization. (swiftlang#24121)" This reverts commit 6466a84. * Reimplement callables using `func call`. Remove `call` declarations. Treat methods named `func call` as call-syntax delegate methods.
Introduce callables: values that can be "called" like functions.
This is experimental functionality and highly subject to change:
the design will be updated based on feedback for SE-0253.