Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions TSPL.docc/ReferenceManual/Attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ indicates the macro's role:
on an extension, a type alias, or a type that's nested inside a function,
or use an extension macro to add an extension that has a peer macro.

- term Body macros:
Write `body` as the first argument to this attribute.
The type that implements the macro conforms to the `BodyMacro` protocol.
These macros modify or replace the body of the function that they are attached to.
If the function has no body,
the macro can generate one from scratch.
Only one body macro is allowed on a function at a time.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some wording adjustments:

Suggested change
- term Body macros:
Write `body` as the first argument to this attribute.
The type that implements the macro conforms to the `BodyMacro` protocol.
These macros modify or replace the body of the function that they are attached to.
If the function has no body,
the macro can generate one from scratch.
Only one body macro is allowed on a function at a time.
- term Body macros:
Write `body` as the first argument to this attribute.
The type that implements the macro conforms to the `BodyMacro` protocol.
These macros can generate, modify, or replace
the body of the function that they're attached to.
You can write at most one body macro on any given function.

I think it reads better to include the possibility of generating the function body as part of the sentence about replacing or modifying the body — that way, all three options are in one place.


The peer and member macro roles require a `names:` argument,
listing the names of the symbols that the macro generates.
The accessor macro role requires a `names:` argument if the
Expand Down