I suggested it because now we can’t call any initializers on Type<T>. If we
add _Type<T>, we can add public initializers and keep Type<T> instances
unique.
// No uniqueness guarantee
internal final class _Type<T> {
var _metatype: Metatype<T>
init()
init(_: AnyMetatype)
init?<U>(casting: Type<U>)
}
internal var _typeStorage = Set<_Type<Any>>()
// Uniqueness guarantee// 'final class' is an implementation detail
public struct Type<T> {
internal var _impl: _Type<T>
// Notice 'public'
public init()
public init(_: AnyMetatype)
public init?<U>(casting: Type<U>)
}
There will be no === operator for Type<T>, because it does not add value.
Type<T> is a wrapper of typeless identifier with value semantics. It is
singleton pattern that makes us use classes.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution