[swift-evolution] [Discussion] Seal `T.Type` into `Type<T>`

Anton Zhilin antonyzhilin at gmail.com
Sat Jul 16 09:11:03 CDT 2016


I tried to better describe my alternative solution here
<https://gist.github.com/Anton3/9931463695f1c3263333e18f04f9cd8e>.

The problem with Mirror is that it can only carry a metatype around and
thats it. You may be able to extract it from there and than what? You’ll
cast it the old fashion way.

Could you please explain, what Mirror can’t do? If you only mean
dispatching static members, then see below.

As I may recall I asked the community in the following thread about Hashable
ability, which isn’t implementable without compiler magic and special
internal protocols.

I suggest to move hashability of metatypes to Mirror. Mirror can be Hashable
the same way as your Type<T>.

Your last API for Type doesn’t solve any problems

I suggest to add size etc to Mirror. Static stuff will be handled by my
version of Type<T> and dynamic stuff — by Mirror.

You’re talking about the lack of the ability of dispatching static members
(you also forget initializer)

Could you please cite, where I wrote about that? All 5 solutions I
presented provide this feature using metatypes.
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160716/ec7d762d/attachment.html>


More information about the swift-evolution mailing list