The review for SE-0389: Attached Macros ran from February 16 to March 2. The language workgroup has decided to accept the proposal.
Feedback on the proposal was light but positive. Two questions were raised during the review that the workgroup gave additional consideration.
The first question was around whether a synthesized memberwise
initshould be suppressed if a macro generates its own
initinto the type declaration to which it is attached. The workgroup concluded that the synthesized
initshould be suppressed in this case, just as it would be if the author had written the initializer by hand. As a general principle, the workgroup believes that the user should expect the same behavior from the compiler when using macros as they would see if they manually substituted the expanded code into their source file.
The workgroup also recognizes that it is desirable to have better control over memberwise initializers as a general feature, so improvements in this space can be made independently of this proposal (but such future work could be implemented using macros).
The second question asked whether attached macros should provide a way to specify generated names that are simultaneously prefixed and suffixed rather than just one of those choices. Such names can be produced using
arbitrary, so the lack of a more specific feature does not make anything impossible—it merely omits a potential compiler optimization. Furthermore, more complex name generation schemes would likely need linguistic transformations to produce names that meet Swift API naming guidelines that are beyond what a combined
Therefore, the language workgroup does not feel that the additional complexity is warranted at this time. If either simultaneous prefix/suffix concatenation or more specific name generation schemes are found to be needed in the future, they can be proposed as additive changes.
Thank you to all who participated in the review!
—Tony Allevato, review manager