{"id":38379,"date":"2023-02-03T16:56:43","date_gmt":"2023-02-03T21:56:43","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=38379"},"modified":"2023-03-08T10:16:23","modified_gmt":"2023-03-08T15:16:23","slug":"designing-swifts-macros-feature","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2023\/02\/03\/designing-swifts-macros-feature\/","title":{"rendered":"Designing Swift&rsquo;s Macros Feature"},"content":{"rendered":"<p><a href=\"https:\/\/sfba.social\/@dgregor79\/109802962472998245\">Doug Gregor<\/a>:<\/p>\n<blockquote cite=\"https:\/\/sfba.social\/@dgregor79\/109802962472998245\"><p>Swift folks, we&rsquo;re busy working on a macros for the Swift language and would love your thoughts. It&rsquo;s a big feature with a lot of details that need to be right.<\/p><p>[&#8230;]<\/p><p>As things are starting to work in the prototype, we&rsquo;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 <a href=\"https:\/\/github.com\/DougGregor\/swift-macro-examples\">here<\/a>.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/gist.github.com\/DougGregor\/de840fcf6d6f307792121eee11c0da85\">Swift Macros Dashboard<\/a>:<\/p>\n<blockquote cite=\"https:\/\/gist.github.com\/DougGregor\/de840fcf6d6f307792121eee11c0da85\"><p>This gist provides a &ldquo;dashboard&rdquo; with links to the various documents and example projects that are part of the Swift Macros effort.<\/p><\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2022\/10\/17\/a-possible-vision-for-macros-in-swift\/\">A Possible Vision for Macros in Swift<\/a><\/li>\n<\/ul>\n\n<p id=\"designing-swifts-macros-feature-update-2023-03-03\">Update (2023-03-03): <a href=\"https:\/\/mastodon.social\/@airspeedswift\/109954389314104340\">Ben Cohen<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@airspeedswift\/109954389314104340\">\n<p>This is a beautifully short <a href=\"https:\/\/github.com\/DougGregor\/swift-macro-examples\/pull\/17\">example<\/a> of how macros have the potential to make swift library code easier to use for everyone.<\/p>\n<\/blockquote>\n\n<p id=\"designing-swifts-macros-feature-update-2023-03-08\">Update (2023-03-08): See also: the <a href=\"https:\/\/forums.swift.org\/t\/pitch-optionset-macro\/63547\">Option Set Declaration Macro pitch<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Doug Gregor: Swift folks, we&rsquo;re busy working on a macros for the Swift language and would love your thoughts. It&rsquo;s a big feature with a lot of details that need to be right.[&#8230;]As things are starting to work in the prototype, we&rsquo;re putting them into a sample repository with a couple of different kinds of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2023-02-03T21:56:46Z","apple_news_api_id":"3c1c9bce-35fd-4235-8a70-cbfaae0744fc","apple_news_api_modified_at":"2023-03-08T15:16:27Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAQ==","apple_news_api_share_url":"https:\/\/apple.news\/APBybzjX9QjWKcMv6rgdE_A","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[46,941,71,901],"class_list":["post-38379","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-languagedesign","tag-macros","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/38379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=38379"}],"version-history":[{"count":3,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/38379\/revisions"}],"predecessor-version":[{"id":38707,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/38379\/revisions\/38707"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=38379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=38379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=38379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}