{"action":"created","issue":{"url":"https://api.github.com/repos/android/android-ktx/issues/488","repository_url":"https://api.github.com/repos/android/android-ktx","labels_url":"https://api.github.com/repos/android/android-ktx/issues/488/labels{/name}","comments_url":"https://api.github.com/repos/android/android-ktx/issues/488/comments","events_url":"https://api.github.com/repos/android/android-ktx/issues/488/events","html_url":"https://github.com/android/android-ktx/issues/488","id":312125046,"number":488,"title":"Extension functions should be used only when they relate closely to the classes they are extending","user":{"login":"RaisedByTheInternet","id":38144572,"avatar_url":"https://avatars2.githubusercontent.com/u/38144572?v=4","gravatar_id":"","url":"https://api.github.com/users/RaisedByTheInternet","html_url":"https://github.com/RaisedByTheInternet","followers_url":"https://api.github.com/users/RaisedByTheInternet/followers","following_url":"https://api.github.com/users/RaisedByTheInternet/following{/other_user}","gists_url":"https://api.github.com/users/RaisedByTheInternet/gists{/gist_id}","starred_url":"https://api.github.com/users/RaisedByTheInternet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RaisedByTheInternet/subscriptions","organizations_url":"https://api.github.com/users/RaisedByTheInternet/orgs","repos_url":"https://api.github.com/users/RaisedByTheInternet/repos","events_url":"https://api.github.com/users/RaisedByTheInternet/events{/privacy}","received_events_url":"https://api.github.com/users/RaisedByTheInternet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-06T21:29:19Z","updated_at":"2018-04-07T20:48:52Z","closed_at":null,"author_association":"NONE","body":"For example, I'm not convinced that it makes sense for [String.parseAsHtml](https://github.com/android/android-ktx/blob/562cc5ac2489678a3ad65f708fc509bf6b47b646/src/main/java/androidx/core/text/Html.kt#L39) to be an extension of String, because this function is not closely related to basic idea of a String.\r\n\r\nThe following code surprises me:\r\n\r\n    \"\".parseAsHtml()\r\n    // the type of the above expression is android.text.Spanned\r\n\r\nThe following, on the other hand, doesn't seem as weird:\r\n\r\n    parseAsHtml(\"\")\r\n    // the type of the above expression is android.text.Spanned"},"comment":{"url":"https://api.github.com/repos/android/android-ktx/issues/comments/379498231","html_url":"https://github.com/android/android-ktx/issues/488#issuecomment-379498231","issue_url":"https://api.github.com/repos/android/android-ktx/issues/488","id":379498231,"user":{"login":"knordbo","id":8756673,"avatar_url":"https://avatars1.githubusercontent.com/u/8756673?v=4","gravatar_id":"","url":"https://api.github.com/users/knordbo","html_url":"https://github.com/knordbo","followers_url":"https://api.github.com/users/knordbo/followers","following_url":"https://api.github.com/users/knordbo/following{/other_user}","gists_url":"https://api.github.com/users/knordbo/gists{/gist_id}","starred_url":"https://api.github.com/users/knordbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knordbo/subscriptions","organizations_url":"https://api.github.com/users/knordbo/orgs","repos_url":"https://api.github.com/users/knordbo/repos","events_url":"https://api.github.com/users/knordbo/events{/privacy}","received_events_url":"https://api.github.com/users/knordbo/received_events","type":"User","site_admin":false},"created_at":"2018-04-07T20:48:52Z","updated_at":"2018-04-07T20:48:52Z","author_association":"NONE","body":"I have similar concern which extensions such as `String.toUri()`. I'm not sure if it scales if each kotlin library adds library specific extensions to Java Platform APIs. It would work fine if the library was modular enough to be consumed as `<library>-ext`  and `<library>-jre-ext` so that those extensions are optional, but this added complexity/confusion on the consumer of the library might not be worth it. If so it's probably safer to not add such extensions. \r\n\r\nTotally fan of all the Android specific extensions on the other hand 👍"}}
{"actor":{"display_login":"knordbo"}}