[swift-evolution] [Pitch] Refactor Metatypes
Adrian Zubarev
adrian.zubarev at devandartist.com
Sun Oct 2 10:40:46 CDT 2016
I’d say that subtype is correct there. As mentioned by some people here subtype feels like it has something to do with classes.
Assume this:
class Base { init() {...} }
class A : Base {}
let subtype: AnyType<Base> = subtype(of: Base.self, named: "A")!
// One day when `.self` magic is gone
let subtype: AnyType<Base> = subtype(of: Base, named: "A")!
let a: Base = subtype.init()
print(type(of: a)) // => A
It’s clear that we’re working with classes here. type(of:named:) seems odd to me and doesn’t fit here at all.
Any more feedback?
Waiting for Brent to reply. I can’t remember what Subprotocol<T> was for. That’s the reason why it looks like this for the moment. ;)
I don’t understand. I renamed Subtype with AnyType everywhere and mentioned it in Alternatives considered section.
I’d like to wait for more feedback, we’re not in rush now.
--
Adrian Zubarev
Sent with Airmail
Am 2. Oktober 2016 um 16:46:18, Anton Zhilin (antonyzhilin at gmail.com) schrieb:
I’m happy that everyone seems to agree on the new naming, and I also like that
type function is back.
Some fixes:
In Future directions, replace
subtype with
type
In Future directions, remove overstruck last item
In Alternatives considered, replace the naming and add old naming to alternative options
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161002/166d72cd/attachment.html>
More information about the swift-evolution
mailing list