> 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.

These have quite different results!

I’m pretty convinced that Swift shouldn’t implicitly allow you to assign 
multiplied(by:) to the same member as you could assign adding(_:) - explicit is 
fine, with some syntax e.g. through a closure, but not implicit!

To correct my goofy pre-coffee not-quite-following-the-naming-guidelines 
suggestion, that would be equivalent of allowing these two to be 
interchangeable:

  func drawLineTo(x: Float, y: Float)
  func drawLineWith(angle: Float, distance: Float)

Which is clearly not something you would expect to be allowed implicitly.


I’m definitely for the concept of the proposal that this is inconsistent, but 
I’m also definitely for making this explicitly disallowed everywhere, not 
allowed everywhere.

I think Erica makes a good point about syntax too, we’ve been assuming:

  // compatible types
  var x = drawLineTo
  x = drawLineWith

but really this isn’t Swifty syntax, the full argument labels provide more 
clarity here; and I’d even be in favor of disallowing the above shortening.

Scott

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to