Quick idea! What if we had a construct similar to typealias
for aliasing things other than types such as properties, methods and free functions? Some examples:
extension Collection {
// Aliasing an instance property.
alias var size = count
}
extension Sequence {
// Aliasing an instance method.
alias func all(match:) = allSatisfy(_:)
alias func any(match:) = contains(where:)
}
// Aliasing a free function.
alias func convolution(_:_:) = zip(_:_:)
// Aliasing a type.
alias protocol Sequence = Collection
// Aliasing a tuple.
alias Point = (x: Double, y: Double)
It might reduce the amount of bikeshedding seen in topics in Evolution as an alias
is just a single line away. It would also be an extremely cool feature to have and beats writing wrappers.
Any thoughts?