[swift-evolution] [Revision] [Pitch] Rename `T.Type`

Boris Wang kona.ming at gmail.com
Sun Jul 24 05:02:05 CDT 2016


Got it, thanks!
Anton Zhilin <antonyzhilin at gmail.com>于2016年7月24日 周日17:32写道:

> 2016-07-24 12:21 GMT+03:00 Boris Wang via swift-evolution <
> swift-evolution at swift.org>:
>
>> just write code in playground:
>> struct MyStruct {
>> var t = 0
>>>> sizeof(MyStruct)
>>
>> Compiler error:
>> Missing '.self' for reference to metatype of type 'MyStruct'
>>
>> The metatype is from swift it self!
>>
>> What the hell was the .self?
>>
>
> Boris, you should write `sizeof(MyStruct.self)` in your example. Removal
> of `.self` is deferred from Swift 3.
> SE lists are not the best place to learn about metatypes, but here is some
> explanation:
> https://gist.github.com/Anton3/25a66751812f14f76cacc5e382339522
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160724/14015ccc/attachment.html>


More information about the swift-evolution mailing list