[swift-users] @_transparent allowing a data member inside an enum inside MemoryLayout.swift
Slava Pestov
spestov at apple.com
Wed Aug 2 23:43:39 CDT 2017
> On Aug 2, 2017, at 4:01 PM, Shyamal Chandra via swift-users <swift-users at swift.org> wrote:
>
> Hi,
>
> After reading the Ray Wenderlich website tutorial [1] about Unsafe Swift, I was checking out this file [3] inside swift/stdlib/public/core titled MemoryLayout.swift. However, I was confused about the @_transparent before the each data member inside the enum. Why is this enum with the data members allowed by the Swift 3 language? What does @_transparent allow you to do that you might not otherwise? Could someone explain because the documentation is still unclear [2]?
@_transparent is only meant for use by the standard library and overlays. However, I’d be happy to answer any questions you may have about this attribute or its implementation, however you’ll need to be more specific. Which parts of TransparentAttr.rst are unclear? Note that the document is somewhat outdated but still largely accurate (some of the individual problems listed at the end have since been fixed, but the overall issues remain).
Slava
>
> Thanks!
>
> Best,
>
> Shyamal Chandra
> shyamalc at gmail.com <mailto:shyamalc at gmail.com>
>
> Sources:
>
> [1] https://www.raywenderlich.com/148569/unsafe-swift <https://www.raywenderlich.com/148569/unsafe-swift>
> [2] https://github.com/apple/swift/blob/master/docs/TransparentAttr.rst <https://github.com/apple/swift/blob/master/docs/TransparentAttr.rst>
> [3] https://github.com/apple/swift/blob/master/stdlib/public/core/MemoryLayout.swift <https://github.com/apple/swift/blob/master/stdlib/public/core/MemoryLayout.swift>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170802/714b9488/attachment.html>
More information about the swift-users
mailing list