[swift-evolution] [Review] SE-0042 Flattening the function type of unapplied method references

Bernd Ohr (jazzbox) jazzbox at 7zz.de
Mon Mar 21 06:40:33 CDT 2016


Sorry for being late!

I am not quite sure!

Although I believe that this is a step in the right direction (inout parameters), I would like to see a more general approach where the unapplied method reference produces not one but ALL possible references!

That means that taking the unspecified reference gives an error when there are two ore more possible solutions (definitions are taken from Joe Groff's proposal):

let f0 = Type.instanceMethod // Error: Type.instanceMethod is ambiguous

Further type specification makes the assignment unambigous:

let f1: (Type, y: Int) -> Int = Type.instanceMethod // OK

let f2: (Type) -> (y: Int) -> Int = Type.instanceMethod // OK

let f3: (y: Int) -> (Type) -> Int = Type.instanceMethod // OK??

Functions like map and reduce then will select the appropriate reference automatically.


However, I must admit that this idea arose rather from a theoretical consideration...


More information about the swift-evolution mailing list