{"comment":{"url":"https://api.github.com/repos/typelift/Swiftz/comments/18816410","html_url":"https://github.com/typelift/Swiftz/commit/b0c4ba12bc4e7d0e6332fa244232c4fbbbb8c982#commitcomment-18816410","id":18816410,"user":{"login":"reidmain","id":535202,"avatar_url":"https://avatars.githubusercontent.com/u/535202?v=3","gravatar_id":"","url":"https://api.github.com/users/reidmain","html_url":"https://github.com/reidmain","followers_url":"https://api.github.com/users/reidmain/followers","following_url":"https://api.github.com/users/reidmain/following{/other_user}","gists_url":"https://api.github.com/users/reidmain/gists{/gist_id}","starred_url":"https://api.github.com/users/reidmain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reidmain/subscriptions","organizations_url":"https://api.github.com/users/reidmain/orgs","repos_url":"https://api.github.com/users/reidmain/repos","events_url":"https://api.github.com/users/reidmain/events{/privacy}","received_events_url":"https://api.github.com/users/reidmain/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":null,"commit_id":"b0c4ba12bc4e7d0e6332fa244232c4fbbbb8c982","created_at":"2016-08-29T17:45:35Z","updated_at":"2016-08-29T17:45:35Z","body":"> Our use-case is not the one that needs fixing :)\r\n\r\nI'm sorry I don't understand what you mean. Who are you suggesting needs to fix things?\r\n\r\nThis extension could suddenly change the implementation of code that isn't even part of the Swift core library.\r\n\r\nConsider\r\n\r\n```\r\nfunc someFunction<T>(myParam: Optional<T>)\r\n{\r\n}\r\n\r\nfunc someFunction(param: String)\r\n{\r\n}\r\n```\r\n\r\nThe details of what the functions do are not really material. Someone wrote a function that takes in a String and also has this other function that can take in an Optional sequence. I'm sure you could debate maybe these things could be named better but that is not the point of contention here. It is not out of the realm of possibility that someone could run into a scenario like this.\r\n\r\nIf you run\r\n```\r\nlet a: String? = nil\r\nsomeFunction(a)\r\n```\r\n\r\nYou get a compiler error indicating that your String has not be unwrapped and prompts you to do so. This is a good indicator that you're not handling an optional correctly.\r\n\r\nHowever if you added this extension it would compile fine and execute. You're saying this is fine and what someone should expect? If someone made a mistake and thought they were working with a concrete String (not an Optional) that the second method should be called and a compiler error not raised simply because Swiftz has decided that all Optionals are Sequences?\r\n\r\nIf so I really think this should be called out in the documentation more because it changes how developers should look at Optionals everywhere in their code."}}
{"actor":{"display_login":"reidmain"}}