Friday, February 3, 2023

Designing Swift’s Macros Feature

Doug Gregor:

Swift folks, we’re busy working on a macros for the Swift language and would love your thoughts. It’s a big feature with a lot of details that need to be right.


As things are starting to work in the prototype, we’re putting them into a sample repository with a couple of different kinds of macros. These demonstrate different aspects of macros, from the kind of code you can generate to how you handle errors. The repository is here.

Swift Macros Dashboard:

This gist provides a “dashboard” with links to the various documents and example projects that are part of the Swift Macros effort.


Update (2023-03-03): Ben Cohen:

This is a beautifully short example of how macros have the potential to make swift library code easier to use for everyone.

Update (2023-03-08): See also: the Option Set Declaration Macro pitch.

Comments RSS · Twitter · Mastodon

Leave a Comment