Methods can share a base name when they share the same basic meaning or when they operate in distinct domains.

For example, the following is encouraged, since the methods do essentially the same things:

extension Shape { /// Returns `true` iff `other` is within the area of `self`. func ** contains ** ( _ other : ** Point ** ) -> Bool { ... } /// Returns `true` iff `other` is entirely within the area of `self`. func ** contains ** ( _ other : ** Shape ** ) -> Bool { ... } /// Returns `true` iff `other` is within the area of `self`. func ** contains ** ( _ other : ** LineSegment ** ) -> Bool { ... } }

And since geometric types and collections are separate domains, this is also fine in the same program:

extension Collection where Element : Equatable { /// Returns `true` iff `self` contains an element equal to /// `sought`. func ** contains ** ( _ sought : Element ) -> Bool { ... } }

However, these index methods have different semantics, and should have been named differently:

extension Database { /// Rebuilds the database's search index func ** index ** () { ... } /// Returns the `n`th row in the given table. func ** index ** ( _ n : Int , inTable : TableID ) -> TableRow { ... } }

Lastly, avoid “overloading on return type” because it causes ambiguities in the presence of type inference.