[swift-evolution] Allow a typealias to be named after the corresponding type
Brent Royal-Gordon
brent at architechies.com
Wed Jun 15 03:35:34 CDT 2016
> public struct BinarySearchTree<Key: Comparable, Value> {
> typealias Node = Node<Key, Value>
> var root: Node?
> }
>
> private class Node<Key: Comparable, Value> { }
>
> This code currently doesn’t compile because the Node typealias circularly references itself. I’d like this syntax to just work, because this are the alternatives:
> - rename the typealias to something like `TheNode`
> - rename the Node class
> - don’t use a typealias at all
- fully qualify the class name with the name of the module:
typealias Node = DataStructureKit.Node<Key, Value>
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list