{"action":"created","issue":{"url":"https://api.github.com/repos/Kotlin/kotlinx.collections.immutable/issues/4","repository_url":"https://api.github.com/repos/Kotlin/kotlinx.collections.immutable","labels_url":"https://api.github.com/repos/Kotlin/kotlinx.collections.immutable/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/Kotlin/kotlinx.collections.immutable/issues/4/comments","events_url":"https://api.github.com/repos/Kotlin/kotlinx.collections.immutable/issues/4/events","html_url":"https://github.com/Kotlin/kotlinx.collections.immutable/issues/4","id":166731981,"number":4,"title":"Builders returning Mutable variants is questionable","user":{"login":"andrewoma","id":156917,"avatar_url":"https://avatars.githubusercontent.com/u/156917?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewoma","html_url":"https://github.com/andrewoma","followers_url":"https://api.github.com/users/andrewoma/followers","following_url":"https://api.github.com/users/andrewoma/following{/other_user}","gists_url":"https://api.github.com/users/andrewoma/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewoma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewoma/subscriptions","organizations_url":"https://api.github.com/users/andrewoma/orgs","repos_url":"https://api.github.com/users/andrewoma/repos","events_url":"https://api.github.com/users/andrewoma/events{/privacy}","received_events_url":"https://api.github.com/users/andrewoma/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-07-21T03:51:10Z","updated_at":"2016-08-15T03:57:51Z","closed_at":null,"body":"e.g. For ImmutableLists, there's no implementation that I know of that supports random insertion of elements. By exposing such methods in builders it will lull users into believing the operations do not involve copying the entire list.\r\n\r\nI'm not sure Builders are really required at all if the implementations are chosen carefully:\r\n- Scala's Vector has efficient append/prepend\r\n- Scala's Map/Set implementations also support efficient modifications"},"comment":{"url":"https://api.github.com/repos/Kotlin/kotlinx.collections.immutable/issues/comments/239725109","html_url":"https://github.com/Kotlin/kotlinx.collections.immutable/issues/4#issuecomment-239725109","issue_url":"https://api.github.com/repos/Kotlin/kotlinx.collections.immutable/issues/4","id":239725109,"user":{"login":"ilya-g","id":4257577,"avatar_url":"https://avatars.githubusercontent.com/u/4257577?v=3","gravatar_id":"","url":"https://api.github.com/users/ilya-g","html_url":"https://github.com/ilya-g","followers_url":"https://api.github.com/users/ilya-g/followers","following_url":"https://api.github.com/users/ilya-g/following{/other_user}","gists_url":"https://api.github.com/users/ilya-g/gists{/gist_id}","starred_url":"https://api.github.com/users/ilya-g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilya-g/subscriptions","organizations_url":"https://api.github.com/users/ilya-g/orgs","repos_url":"https://api.github.com/users/ilya-g/repos","events_url":"https://api.github.com/users/ilya-g/events{/privacy}","received_events_url":"https://api.github.com/users/ilya-g/received_events","type":"User","site_admin":false},"created_at":"2016-08-15T03:57:51Z","updated_at":"2016-08-15T03:57:51Z","body":"Before we continue the discussion may I ensure we have a common understanding of what the proposed builders are and what they are not?\r\n\r\nBuilders are not mutators. They do not provide a way to mutate an immutable collection (otherwise it hardly can be called immutable). An immutable collection keeps its content unchanged under any circumstances.\r\n\r\nInstead builders are an approach to build a new immutable collection instance from an existing one. Let me illustrate it with an example:\r\n\r\n```kotlin\r\n// you have an immutable collection\r\nval list = immutableListOf(1, 2, 3)\r\n// you can get modified collection by invoking \r\n// operations directly on immutable collection\r\nvar list2 = list.add(4)\r\n// and again\r\nlist2 = list2.add(5)\r\n\r\n// or you can use a builder\r\nval listBuilder = list.builder()\r\n// now listBuilder is a MutableList with the contents of list\r\nlistBuilder.add(4)\r\nlistBuilder.add(5)\r\nval list3 = listBuilder.build()\r\n// list3 is a new immutable collection with 5 elements and\r\n// list is still unchanged holding its three elements\r\n```\r\n\r\nGiven the above, are those arguments against builders still valid?"}}
{"actor":{"display_login":"ilya-g"}}