{"id":10649,"date":"2015-02-01T18:58:33","date_gmt":"2015-02-01T23:58:33","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=10649"},"modified":"2015-02-01T18:58:33","modified_gmt":"2015-02-01T23:58:33","slug":"categorical","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/02\/01\/categorical\/","title":{"rendered":"Categorical"},"content":{"rendered":"<p><a href=\"http:\/\/khanlou.com\/2015\/01\/categorical\/\">Soroush Khanlou<\/a>:<\/p>\n<blockquote cite=\"http:\/\/khanlou.com\/2015\/01\/categorical\/\"><p><code>-[NSString containsString:]<\/code> was added in iOS 8. If you&rsquo;re writing a standard library, this seems like one of the most crucial components for string handling. And yet, it&rsquo;s been conspicuously absent since the early &rsquo;90s, when NSString was created.<\/p><p>[&#8230;]<\/p><p>So given these myriad reasons why categories aren&rsquo;t good enough, why will Apple not implement these methods?<\/p><p>[&#8230;]<\/p><p>Other vendors have proven that it&rsquo;s possible to do this well. Ruby, for example, takes it to the other extreme: their Integer objects respond to methods like <code>#odd?<\/code>, <code>#even?<\/code> and even <code>#gcd<\/code>. Providing those methods in the standard library yields more readable code <em>and<\/em> it gives the vendor the opportunity to tweak and optimize them at later date, knowing that anyone who needs them will benefit from their optimizations.<\/p><p>[&#8230;]<\/p><p>In the same way that base types like Swift&rsquo;s Optional or JavaScript ES6&rsquo;s Promises must be built-in for proper adoption, these simple methods need to be available to all developers. Apple&rsquo;s proclivity towards leaving holes in their API forces developers into a bind. We must either write inexpressive, hard-to-read code, do needless work opening these classes back up, or leave a trail of dependencies in our wake.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Soroush Khanlou: -[NSString containsString:] was added in iOS 8. If you&rsquo;re writing a standard library, this seems like one of the most crucial components for string handling. And yet, it&rsquo;s been conspicuously absent since the early &rsquo;90s, when NSString was created.[&#8230;]So given these myriad reasons why categories aren&rsquo;t good enough, why will Apple not implement [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","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":[69,31,30,54,71],"class_list":["post-10649","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-ios","tag-mac","tag-objective-c","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10649","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=10649"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10649\/revisions"}],"predecessor-version":[{"id":10650,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10649\/revisions\/10650"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=10649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=10649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=10649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}