Actually that could cause more ambiguity if a type String is created inside ModuleA or ModuleB for example. So yeah, I think “from” keyword would be the best option actually. :(
> On Jun 7, 2016, at 5:23 PM, Paulo Faria <pa...@zewo.io> wrote: > > > >> Begin forwarded message: >> >> From: Paulo Faria <pa...@zewo.io <mailto:pa...@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 <br...@architechies.com >> <mailto:br...@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() -> String >> >> >> Specifically ModuleA.String:2:17 and ModuleB.String:2:17. So it seems to me >> that Brent's proposal makes a lot of sense actually! >> >>> On Jun 7, 2016, at 8:24 AM, Brent Royal-Gordon <br...@architechies.com >>> <mailto:br...@architechies.com>> wrote: >>> >>>> 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. >>>> >>>> https://gist.github.com/paulofaria/f48d0b847a0fb7c125d163d0e349500a >>>> <https://gist.github.com/paulofaria/f48d0b847a0fb7c125d163d0e349500a> >>>> >>>> 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 >>> >> >
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution