{"id":13230,"date":"2016-01-08T17:32:59","date_gmt":"2016-01-08T22:32:59","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=13230"},"modified":"2016-01-08T17:32:59","modified_gmt":"2016-01-08T22:32:59","slug":"generic-collections-subsequences-and-overloading","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2016\/01\/08\/generic-collections-subsequences-and-overloading\/","title":{"rendered":"Generic Collections, SubSequences and Overloading"},"content":{"rendered":"<p><a href=\"http:\/\/airspeedvelocity.net\/2016\/01\/03\/generic-collections-subsequences-and-overloading\/\">Airspeed Velocity<\/a>:<\/p>\n<blockquote cite=\"http:\/\/airspeedvelocity.net\/2016\/01\/03\/generic-collections-subsequences-and-overloading\/\">\n<p>And before long you smack your head against one of the more confusing things about generic collections: a sequence&rsquo;s <code>SubSequence<\/code> doesn&rsquo;t necessarily contain the same element type as that sequence. This usually manifests itself in one of those compiler errors that has you yelling &ldquo;what are you talking about you infernal machine&rdquo; at the compiler before eventually realizing what you&rsquo;ve done wrong and sheepishly fixing it.<\/p>\n<p>[&#8230;]<\/p>\n<p>There&rsquo;s nothing about this definition that forces the elements of <code>SubSequence<\/code> to be anything specific. Really, this needs a <code>where<\/code> clause on the typealias &#8211; something that Swift doesn&rsquo;t currently support[&#8230;] So, in the mean-time, the way around this is to specify any requirements like this as part of the declaration.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Airspeed Velocity: And before long you smack your head against one of the more confusing things about generic collections: a sequence&rsquo;s SubSequence doesn&rsquo;t necessarily contain the same element type as that sequence. This usually manifests itself in one of those compiler errors that has you yelling &ldquo;what are you talking about you infernal machine&rdquo; at [&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-13230","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\/13230","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=13230"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/13230\/revisions"}],"predecessor-version":[{"id":13231,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/13230\/revisions\/13231"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=13230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=13230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=13230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}