There is also some lack of expressiveness in the language. For example type(of:)
function isn't implemented in Swift because right now there is no way to split the merged meta type kinds.
One day we 'might' get another keyword meta
alongside some
and any
. That keyword and things like _typeByName
would potentially allow us to express a function like:
func subtype<T>(of type: meta T, named name: String) -> (any meta T)?
Usage:
let type: (any meta Any)? = subtype(of: Any.self, named: "Bool")
type == Bool.self // true
Here are some more details around that idea: