On Thu, Jun 30, 2016 at 3:30 PM, Scott James Remnant via swift-evolution < [email protected]> wrote:
> As with the original proposal, your examples here don't obey the Naming > Guidelines. > > If we're going to pretend that Swift is C, we wouldn't have a distinction > between argument labels and parameter names in the first place! > > Is there an example of two functions, obeying the naming guidelines, which > have different argument labels (not parameter names) for parameters of the > same type, where it makes sense to cross-call them? > Sure there are. For example, `adding(_:)` and `multiplied(by:)` in the new Integer protocol. > > Scott > > > On Jun 30, 2016, at 1:11 PM, Vladimir.S <[email protected]> wrote: > > > > 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 [email protected] > >> https://lists.swift.org/mailman/listinfo/swift-evolution > >> > > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
