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

Anton Zhilin antonyzhilin at gmail.com
Sun Jul 24 04:32:15 CDT 2016


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/ec010795/attachment.html>


More information about the swift-evolution mailing list