{"id":1772,"date":"2008-08-28T09:59:52","date_gmt":"2008-08-28T13:59:52","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=1772"},"modified":"2008-08-30T11:17:09","modified_gmt":"2008-08-30T15:17:09","slug":"blocks-in-objective-c","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2008\/08\/28\/blocks-in-objective-c\/","title":{"rendered":"Blocks in Objective-C"},"content":{"rendered":"<p>Apple is <a href=\"http:\/\/lists.cs.uiuc.edu\/pipermail\/cfe-dev\/2008-August\/002670.html\">adding blocks<\/a> (a.k.a. closures) to Objective-C (via <a href=\"http:\/\/twitter.com\/rtmfd\/statuses\/901261565\">Ian Baird<\/a>):<\/p>\n<blockquote cite=\"http:\/\/lists.cs.uiuc.edu\/pipermail\/cfe-dev\/2008-August\/002670.html\">\n<p>From a technical perspective, blocks fit into C in a couple places:  \n1) a new declaration type (the caret) which work very much like a  \nmagic kind of pointer that can only point to function types. 2) block  \nliterals, which capture the computation  3) a new storage class  \n__block 4) a really tiny runtime library.<\/p>\n<p>The new storage class comes into play when you want to get mutable  \naccess to variables on the stack.  Basically you can mark an otherwise- \nauto variable with __block&#8230;<\/p>\n<\/blockquote>\n<p>Update (2008-08-30): <a href=\"http:\/\/mooseyard.com\/Jens\/2008\/08\/blocksclosures-for-c\/\">Jens Alfke<\/a> comments.<\/p>","protected":false},"excerpt":{"rendered":"<p>Apple is adding blocks (a.k.a. closures) to Objective-C (via Ian Baird): From a technical perspective, blocks fit into C in a couple places: 1) a new declaration type (the caret) which work very much like a magic kind of pointer that can only point to function types. 2) block literals, which capture the computation 3) [&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":[],"class_list":["post-1772","post","type-post","status-publish","format-standard","hentry","category-programming-category"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/1772","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=1772"}],"version-history":[{"count":0,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/1772\/revisions"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=1772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=1772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=1772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}