[swift-evolution] [Pitch] Introduce user-defined dynamically "callable" types
Tino Heth
2th at gmx.de
Sun Nov 12 05:33:44 CST 2017
> Am 11.11.2017 um 19:03 schrieb Chris Lattner <sabre at nondot.org>:
>
>> Swift is quite flexible on what can act as a closure — would it be allowed to use a dynamic callable in that context?
>> I guess forwarding of
>>
>> let closure: ([(String, Int)]) -> Int = DynamicCallableType()
>>
>> to the dynamicCall method of DynamicCallableType isn’t that hard, but wouldn’t it be odd if the value of closure changes when you leave out its type?
>
> I’m not sure I understand what you’re getting at. Can you show how this would work with the example in the motivation section?
I’m just asking if this should work ;-) — I didn’t see anything regarding it in the proposal.
But to take something from the document:
// file = open(filename)
let file = Python.open.call(filename)
let openFile: (String) -> FileHandle? = Python.open // is this be possible, or an error?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171112/7b7f9967/attachment.html>
More information about the swift-evolution
mailing list