What is your evaluation of the proposal?
This is great. I love the balance of power and expressiveness. The independent application of the various roles will be a great help to understanding the effects of a multi-role macro.
Is the problem being addressed significant enough to warrant a change to Swift?
Yes. This will empower library authors to produce even more powerful tools without burdening clients with boilerplate.
Does this proposal fit well with the feel and direction of Swift?
Yes. The guard rails provided by macro roles feel appropriate to the language.
The new shadowing possible by replacing a macro with its expansion is a bit odd. It doesn’t strike me as something that will be problematic in practice, though folks working on tooling that allows in-place visualization of expansions might need to worry about this corner case.
If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
Scheme/Racket macros don’t really compare, since Swift isn’t s-expression-based. Java attributes are superficially similar, but I understand that such decorator annotations are for a separate proposal.
How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
I studied the proposal, the Vision document, and the expression macros proposal.
A nit:
In the example expansion of the AddCompletionHandler macro…
func fetchAvatar(_ username: String, onCompletion: @escaping (Image?) -> Void) {
Task.detached {
completionHandler(await fetchAvatar(username))
}
}
…shouldn’t the closure invoked inside the detached task be named onCompletion? I was confused here trying to reconcile the default argument in the macro definition vs. the given argument in the macro application.