From: Paulo Faria <paulo@zewo.io>
Subject: Re: [swift-evolution] Name disambiguation of computed property/function with same type defined in extensions
Date: June 7, 2016 at 4:08:16 PM GMT-3
To: Brent Royal-Gordon <brent@architechies.com>Yeah! I really like that option. no new keyword and it makes a lot of sense cause look at the error message:
error: ambiguous use of 'capitalized()'
let capitalized = "hello swift".capitalized()
^
ModuleA.String:2:17: note: found this candidate
public func capitalized() -> String
^
ModuleB.String:2:17: note: found this candidate
public func capitalized() -> StringSpecifically ModuleA.String:2:17 and ModuleB.String:2:17. So it seems to me that Brent's proposal makes a lot of sense actually!
I want to discuss the problem of name ambiguity when a computed property or function is defined with the same name and type in different modules. Currently there’s no way to disambiguate the implementation in use cases similar to the one contained in the gist below.
The gist also contains some informal proposals. The idea is to create a formal proposal based on the discussion that shall follow.
We already have the concept of prefixing a type name with a module to disambiguate when two modules have the same type. I wonder if we could do the same thing to disambiguate between conflicting extensions?
import ModuleA
import ModuleB
("hello world" as ModuleA.String).capitalized() // Swift.String, with only APIs known to ModuleA
("hello world" as ModuleB.String).capitalized() // Swift.String, with only APIs known to ModuleB
"hello world".capitalized() // Still causes a compile-time error for ambiguity--
Brent Royal-Gordon
Architechies
···
Begin forwarded message:
On Jun 7, 2016, at 8:24 AM, Brent Royal-Gordon <brent@architechies.com> wrote: