swift-book icon indicating copy to clipboard operation
swift-book copied to clipboard

Access Control — Mention macros in the intro

Open tadbyt opened this issue 1 year ago • 1 comments

Location

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/accesscontrol

Description

This subsection doesn't reflect the changes to Swift with respect to macros and packages.

Correction

Reword the first sentence in the first paragraph to: Access control restricts access to parts of your code from code in other types, source files, modules and packages. Add the following sentence to the end of the second paragraph: However, both macro declarations and their associated implementation types must have public access since the code that declares a macro is in a different module than that that implements it.

tadbyt avatar Jan 04 '24 17:01 tadbyt

This appears to already be covered in the Macros chapter, which is the appropriate place for this detail anyhow.

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/macros#Macro-Declarations

Macros are always declared as public. Because the code that declares a macro is in a different module from code that uses that macro, there isn’t anywhere you could apply a nonpublic macro.

amartini51 avatar Jan 17 '24 17:01 amartini51