{"id":9393,"date":"2014-08-24T15:47:56","date_gmt":"2014-08-24T19:47:56","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=9393"},"modified":"2014-08-24T15:47:56","modified_gmt":"2014-08-24T19:47:56","slug":"macro-like-syntax-extensions-through-pseudo-closures","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2014\/08\/24\/macro-like-syntax-extensions-through-pseudo-closures\/","title":{"rendered":"Macro-like Syntax Extensions Through Pseudo-closures"},"content":{"rendered":"<p><a href=\"http:\/\/swiftopinions.wordpress.com\/2014\/08\/22\/macro-like-syntax-extensions-through-pseudo-closures-a-syntax-proposal\/\">Christoffer Lern&ouml;<\/a>:<\/p>\n<blockquote cite=\"http:\/\/swiftopinions.wordpress.com\/2014\/08\/22\/macro-like-syntax-extensions-through-pseudo-closures-a-syntax-proposal\/\"><p>For normal closures there is no way to fix this problem.&nbsp;We can only have the closure return to it&rsquo;s caller, which in this case is the function <strong>times<\/strong>&nbsp;we added to <strong>Int<\/strong>.<\/p>\n<p>In many languages with macros, we would construct syntax by directly working with the syntax tree created by the compiler. This is can get fairly advanced and isn&rsquo;t very easy to read.<\/p>\n<p>As we see in this example we could do a lot of nice things if we just had something which &ldquo;looks like a closure but unwinds the stack like an exception&rdquo;<\/p><\/blockquote>\n<p>I would really like to see something like this in Swift.<\/p>","protected":false},"excerpt":{"rendered":"<p>Christoffer Lern&ouml;: For normal closures there is no way to fix this problem.&nbsp;We can only have the closure return to it&rsquo;s caller, which in this case is the function times&nbsp;we added to Int. In many languages with macros, we would construct syntax by directly working with the syntax tree created by the compiler. This is [&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":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","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,71,901],"class_list":["post-9393","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-languagedesign","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9393","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=9393"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9393\/revisions"}],"predecessor-version":[{"id":9394,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9393\/revisions\/9394"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=9393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=9393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=9393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}