[swift-evolution] [swift-evolution-announce] [Review] SE-0111: Remove type system significance of function argument labels

Vladimir.S svabox at gmail.com
Thu Jun 30 15:11:12 CDT 2016


On 30.06.2016 21:56, Scott James Remnant via swift-evolution wrote:
>> They already *are* type compatible. This works right now:
>>
>> var a : (ofHits: Int, forRuns: Int) -> Bool = meetsBattingAverage a =
>> sinkBattleship // ??? a(ofHits: 1, forRuns: 2)
>
> Your proposal does not make it clear that this works (which is
> surprising to me).
>
> I would argue the proposal the other way: that there should be an error
> on line 2, and this should not be permitted implicitly.

I'm not sure if this is a definitely bad thing. Let's assume I have a 
number of funcs with similar but different labels and I want to define a 
function variable with another labels and assign one of these funcs:

func foo(one: Int, two: Int) {..}
func bar(first: Int, second: Int) {..}

var a : (alfa: Int, betta: Int) -> () = foo
a(alfa: 1, betta: 2)
a = bar
a(alfa: 1, betta: 2)

But the type of `a` is still (Int, Int) -> () the same as for `foo` and `bar`

>
> Scott _______________________________________________ swift-evolution
> mailing list swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>


More information about the swift-evolution mailing list