{"id":5291,"date":"2012-07-07T16:54:26","date_gmt":"2012-07-07T21:54:26","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=5291"},"modified":"2012-07-07T16:54:28","modified_gmt":"2012-07-07T21:54:28","slug":"lets-build-nsnumber","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2012\/07\/07\/lets-build-nsnumber\/","title":{"rendered":"Let&rsquo;s Build NSNumber"},"content":{"rendered":"<p><a href=\"http:\/\/www.mikeash.com\/pyblog\/friday-qa-2012-07-06-lets-build-nsnumber.html\">Mike Ash<\/a>:<\/p>\n<blockquote cite=\"http:\/\/www.mikeash.com\/pyblog\/friday-qa-2012-07-06-lets-build-nsnumber.html\"><p><code>NSNumber<\/code> is a conceptually simple class which mainly exists so that we can stuff numeric values into Cocoa collections, but its flexibility implies a fair amount of underlying complication. By implementing a workalike <code>MANumber<\/code> class, we can see what kinds of things <code>NSNumber<\/code> has to be doing on the inside. Automatic conversion to different integer types requires a fair amount of boilerplate code, and reliable conversion between number of different types can get pretty complicated.<\/p><\/blockquote>\n<p>Python&rsquo;s implementation of number objects is also interesting.<\/p>","protected":false},"excerpt":{"rendered":"<p>Mike Ash: NSNumber is a conceptually simple class which mainly exists so that we can stuff numeric values into Cocoa collections, but its flexibility implies a fair amount of underlying complication. By implementing a workalike MANumber class, we can see what kinds of things NSNumber has to be doing on the inside. Automatic conversion to [&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-5291","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\/5291","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=5291"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/5291\/revisions"}],"predecessor-version":[{"id":5293,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/5291\/revisions\/5293"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=5291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=5291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=5291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}