# Function body macros

**URL:** <https://forums.swift.org/t/function-body-macros/66471>\
**Category:** Pitches\
**Created:** [July 31, 2023, 6:14am UTC](https://forums.swift.org/t/function-body-macros/66471 "2023-07-31T06:14:49Z")\
**Posts on this page:** 1\
**Showing post:** 33

<div class="post-metadata">

**Author:** ![kabiroberai](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kabiroberai/32/28072_2.png) [@kabiroberai](https://forums.swift.org/u/kabiroberai)\
**Post date:** [July 31, 2023, 11:30pm UTC](https://forums.swift.org/t/function-body-macros/66471/33 "2023-07-31T23:30:43Z")

</div>

This sounds great, especially in the form suggested in the alternatives section: that is, if preamble macros were replaced with “wrapper” macros (maybe we could borrow from Python and call them “decorator” macros?)

Besides what others have said, it sounds like implementing the decorator style could remove the need for preamble macros entirely — it’s very possible I’m missing something but aren’t the latter effectively a subset of the former? Seems to me that if users wanted to add a preamble they could return `{ preamble; return h-impl }()`

In summary I think the ideal state would be keeping two macro types from this proposal: decorator (can’t rewrite the body but can compose) and body (can rewrite, can’t compose).

---

_[View the full topic](https://forums.swift.org/t/function-body-macros/66471)._
