[swift-evolution] Name disambiguation of computed property/function with same type defined in extensions

Paulo Faria paulo at zewo.io
Thu Jun 9 08:52:37 CDT 2016


> A bonus is if we can use this same thing for globals. We have a problem today where “Foo.Bar” can’t refer to a member of a module if there’s also a type named “Foo”; changing the syntax to “Foo::Bar” or “Bar from Foo” (or adding it as an alternative) would solve that problem and provide consistency.

So you mean the syntax for module namespacing would be “::” for everything? Yeah that would probably solve some other related problems as well. I’m not very fond of the “::” separator. But yeah, I think a different separator would be better than the “from” keyword, then. Maybe we can come up with a nicer separator? the options I can think of are (in order of preference):

Foo:Bar
Foo::Bar
Foo#Bar
Foo at Bar

Anything too different from this would be too exotic. Would there be too much problem with a single colon “:”?

struct Baz: Foo:Bar {
  ...
}

let dictionary: [Swift:String: Foo:Bar] = [:]

I’m sensing yes. :(


More information about the swift-evolution mailing list