[Accepted] SE-0415: Function Body Macros

Hello, Swift community!

The second review of SE-0415: Function Body Macros ended on May 20th.

Feedback during the second review was light but positive. The Language Steering Group agrees with the proposal author that the subset of body macros described by the revised proposal is a valuable feature on its own, with future work devising structured solutions for composing multiple body macros and simplifying common tasks like wrapping function bodies. Therefore, we have accepted this proposal.

Thanks to everybody who participated in the reviews!

—Tony Allevato, review manager


I’m glad such a flexible macro role was introduced. I only hope that in the future we get more granular function body macros that tell the compiler what names they’ll be introducing/removing so that the original body can be type checked. I imagine debugging compiler errors with the current feature will be pretty challenging. Especially when not using Xcode which is one of the few IDEs with convenient inline macro-expansion functionality.

This is really exciting and a macro that I'm STOKED to start working with - thanks Swift team for your work on this :tada:

Very glad to see this. I've been needing this capability for some time.

Any chance this will make it into Swift 6.0?

Yes, this is on the 6.0 branch: [6.0] [SE-0415] Enable function body macros by default by DougGregor · Pull Request #73765 · apple/swift · GitHub