ssly
(Fangchang)
1
Can macros only add new variables or methods with fixed names?
Pippin
(Ethan Pippin)
2
Macros can add arbitrary names, except at the global scope:
@attached(member, names: arbitrary)
public macro MyMacro() = ...
From the book:
The macro declaration also includes arbitrary after the list of names, allowing the macro to generate declarations whose names aren’t known until you use the macro.
1 Like
ssly
(Fangchang)
4
Unfortunately, I want to use a peer macro to generate a top level new type
...