{"id":11555,"date":"2015-06-22T16:25:09","date_gmt":"2015-06-22T20:25:09","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=11555"},"modified":"2015-06-22T16:25:09","modified_gmt":"2015-06-22T20:25:09","slug":"swift-protocols-question","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/06\/22\/swift-protocols-question\/","title":{"rendered":"Swift Protocols Question"},"content":{"rendered":"<p><a href=\"http:\/\/inessential.com\/2015\/06\/21\/swift_protocols_question\">Brent Simmons<\/a>:<\/p>\n<blockquote cite=\"http:\/\/inessential.com\/2015\/06\/21\/swift_protocols_question\">\n<p>The essence of the best answers was this: <code>Value<\/code> should not be <code>Equatable<\/code> &mdash; the <em>individual structs<\/em> should be <code>Equatable<\/code>.<\/p>\n<p>[&#8230;]<\/p>\n<p>In the end, I&rsquo;m still tempted to say the Objective-C version was simpler. And it is, and not just because I&rsquo;m more familiar with Objective-C. But it&rsquo;s important to note that it&rsquo;s not apples-to-apples. In Objective-C I&rsquo;m creating classes instead of structs, and there&rsquo;s no support for the == operator.<\/p>\n<p>But I will say this: Objective-C, because it&rsquo;s less strict with types, is closer to a scripting language than Swift is.<\/p>\n<p>[&#8230;]<\/p>\n<p>Though Swift does get rid of a bunch of housekeeping &mdash; we can use type inference much of the time, we don&rsquo;t have to create .h files, etc. &mdash; it adds its own housekeeping mandated by a stricter type system (and optionals).<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Brent Simmons: The essence of the best answers was this: Value should not be Equatable &mdash; the individual structs should be Equatable. [&#8230;] In the end, I&rsquo;m still tempted to say the Objective-C version was simpler. And it is, and not just because I&rsquo;m more familiar with Objective-C. But it&rsquo;s important to note that it&rsquo;s [&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,54,71,901],"class_list":["post-11555","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-languagedesign","tag-objective-c","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11555","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=11555"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11555\/revisions"}],"predecessor-version":[{"id":11556,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11555\/revisions\/11556"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=11555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=11555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=11555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}