What's @_transparent for?

Also, is there a list of attributes used in the standard library, much like the one in The Swift Programming Language book?

@_transparent is an underscored (stdlib-private) attribute. You shouldn’t use it in your own libraries or applications (given the sub-forum, you probably know this - just making it clear for anyone else).

But FWIW, it is documented: https://github.com/apple/swift/blob/master/docs/TransparentAttr.md

Other attributes are documented in the standard library programmer’s manual (but not all of them - for instance, it doesn’t appear that @_alwaysEmitInToClient is documented there): https://github.com/apple/swift/blob/master/docs/StandardLibraryProgrammersManual.md#annotations

1 Like

@_transparent is an extremely strong form of @inlinable that ensures the call’s stack frame isn’t even preserved in the debug info. For example, if you try to set a breakpoint in Int.+(_:_:), you’ll probably never see it hit in your program; this is because the operator is marked @_transparent.

Like all underscored attributes, @_transparent is not intended for ordinary language users and its meaning could change if we happen to need something different from it.

6 Likes
Terms of Service

Privacy Policy

Cookie Policy