@_transparent allowing a data member inside an enum inside MemoryLayout.swift

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]?

Thanks!

Best,

Shyamal Chandra
shyamalc@gmail.com

Sources:

[1] https://www.raywenderlich.com/148569/unsafe-swift
[2] https://github.com/apple/swift/blob/master/docs/TransparentAttr.rst
[3]
https://github.com/apple/swift/blob/master/stdlib/public/core/MemoryLayout.swift

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

···

On Aug 2, 2017, at 4:01 PM, Shyamal Chandra via swift-users <swift-users@swift.org> wrote:

Thanks!

Best,

Shyamal Chandra
shyamalc@gmail.com <mailto:shyamalc@gmail.com>

Sources:

[1] https://www.raywenderlich.com/148569/unsafe-swift
[2] https://github.com/apple/swift/blob/master/docs/TransparentAttr.rst
[3] https://github.com/apple/swift/blob/master/stdlib/public/core/MemoryLayout.swift
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Terms of Service

Privacy Policy

Cookie Policy