Hi everyone. The review discussion for SE-0367, Conditional compilation for attributes, has concluded, and the Language Working Group has decided to accept the proposal. Reviewers agreed that the addition of a
hasAttribute condition for
#if blocks fills an obvious gap in the ability for library writers to incrementally adopt new attributes, and for the compiler itself to generate interface files that use new attributes where appropriate while maintaining backward compatibility to older compilers.
There was some discussion of whether the attribute should have some degree of support for user-defined attributes such as property wrappers, even if only to be able to diagnose when users try to apply
hasAttribute to them and explain why it doesn't work, but the implementers did not think that this would be feasible to implement, given the level of semantic analysis necessary to look up custom attribute types, and the circular dependency that could create when
#if evaluation determines what declarations are even subject to semantic analysis beyond parsing.
Thank you to everyone who participated in the review!