{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments/30667540","id":30667540,"diff_hunk":"@@ -0,0 +1,325 @@\n+- Feature Name: indexed_assignment\n+- Start Date: 2015-05-19\n+- RFC PR: (leave this empty)\n+- Rust Issue: (leave this empty)\n+\n+# Summary\n+\n+Add a `IndexAssign` trait that allows overloading \"indexed assignment\" expressions like `a[b] = c`.\n+\n+# Motivation\n+\n+Let users define syntactic sugar for operations like these:\n+\n+- Inserting a *new* key-value pair into a map\n+\n+``` rust\n+let mut map = HashMap::new();\n+map[key] = value;  // equivalent to `map.insert(key, value);`\n+```\n+\n+- Setting each element of a \"slice\" to some value\n+\n+(slice, as in a fraction of a collection, which may not necessarily be stored in contiguous memory)\n+\n+``` rust\n+let mut matrix = { .. };\n+\n+// Set each element of the second row of `matrix` to `1`","path":"text/0000-index-assign.md","position":28,"original_position":28,"commit_id":"b95ae6b514cd3f21fa77c46c59c7a9a3e755da45","original_commit_id":"b95ae6b514cd3f21fa77c46c59c7a9a3e755da45","user":{"login":"japaric","id":5018213,"avatar_url":"https://avatars.githubusercontent.com/u/5018213?v=3","gravatar_id":"","url":"https://api.github.com/users/japaric","html_url":"https://github.com/japaric","followers_url":"https://api.github.com/users/japaric/followers","following_url":"https://api.github.com/users/japaric/following{/other_user}","gists_url":"https://api.github.com/users/japaric/gists{/gist_id}","starred_url":"https://api.github.com/users/japaric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/japaric/subscriptions","organizations_url":"https://api.github.com/users/japaric/orgs","repos_url":"https://api.github.com/users/japaric/repos","events_url":"https://api.github.com/users/japaric/events{/privacy}","received_events_url":"https://api.github.com/users/japaric/received_events","type":"User","site_admin":false},"body":"This sugar is common in languages aimed at numerical/scientific computing see [NumPy], [Julia] and [Matlab]/Octave. It would be helpful for libraries that want to compete in the same space to be able to provide a similar syntax to ease adoption/porting.\r\n\r\nI don't think that this form of sugar will become common in other areas/mainstream Rust.\r\n\r\n[NumPy]: http://wiki.scipy.org/Tentative_NumPy_Tutorial#head-864862d3f2bb4c32f04260fac61eb4ef34788c4c\r\n[Julia]: http://docs.julialang.org/en/release-0.3/manual/arrays/#assignment\r\n[Matlab]: http://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html","created_at":"2015-05-20T02:36:42Z","updated_at":"2015-05-20T02:36:42Z","html_url":"https://github.com/rust-lang/rfcs/pull/1129#discussion_r30667540","pull_request_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/1129","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments/30667540"},"html":{"href":"https://github.com/rust-lang/rfcs/pull/1129#discussion_r30667540"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/1129"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/1129","id":35785784,"html_url":"https://github.com/rust-lang/rfcs/pull/1129","diff_url":"https://github.com/rust-lang/rfcs/pull/1129.diff","patch_url":"https://github.com/rust-lang/rfcs/pull/1129.patch","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1129","number":1129,"state":"open","locked":false,"title":"IndexAssign: overloading the `a[b] = c` expression","user":{"login":"japaric","id":5018213,"avatar_url":"https://avatars.githubusercontent.com/u/5018213?v=3","gravatar_id":"","url":"https://api.github.com/users/japaric","html_url":"https://github.com/japaric","followers_url":"https://api.github.com/users/japaric/followers","following_url":"https://api.github.com/users/japaric/following{/other_user}","gists_url":"https://api.github.com/users/japaric/gists{/gist_id}","starred_url":"https://api.github.com/users/japaric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/japaric/subscriptions","organizations_url":"https://api.github.com/users/japaric/orgs","repos_url":"https://api.github.com/users/japaric/repos","events_url":"https://api.github.com/users/japaric/events{/privacy}","received_events_url":"https://api.github.com/users/japaric/received_events","type":"User","site_admin":false},"body":"[Rendered](https://github.com/japaric/rfcs/blob/index-assign/text/0000-index-assign.md)\r\n\r\nImplementation: rust-lang/rust#25628\r\n\r\ncc @sfackler @Gankro\r\n~~cc @rust-lang/lang-team~~ cc @nikomatsakis @aturon @huonw @nrc @pnkfelix \r\ncc #997","created_at":"2015-05-19T23:35:10Z","updated_at":"2015-05-20T02:36:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"53370307650c895c66b110df75f3fd454d8c3fbc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/1129/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/1129/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1129/comments","statuses_url":"https://api.github.com/repos/rust-lang/rfcs/statuses/b95ae6b514cd3f21fa77c46c59c7a9a3e755da45","head":{"label":"japaric:index-assign","ref":"index-assign","sha":"b95ae6b514cd3f21fa77c46c59c7a9a3e755da45","user":{"login":"japaric","id":5018213,"avatar_url":"https://avatars.githubusercontent.com/u/5018213?v=3","gravatar_id":"","url":"https://api.github.com/users/japaric","html_url":"https://github.com/japaric","followers_url":"https://api.github.com/users/japaric/followers","following_url":"https://api.github.com/users/japaric/following{/other_user}","gists_url":"https://api.github.com/users/japaric/gists{/gist_id}","starred_url":"https://api.github.com/users/japaric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/japaric/subscriptions","organizations_url":"https://api.github.com/users/japaric/orgs","repos_url":"https://api.github.com/users/japaric/repos","events_url":"https://api.github.com/users/japaric/events{/privacy}","received_events_url":"https://api.github.com/users/japaric/received_events","type":"User","site_admin":false},"repo":{"id":23169738,"name":"rfcs","full_name":"japaric/rfcs","owner":{"login":"japaric","id":5018213,"avatar_url":"https://avatars.githubusercontent.com/u/5018213?v=3","gravatar_id":"","url":"https://api.github.com/users/japaric","html_url":"https://github.com/japaric","followers_url":"https://api.github.com/users/japaric/followers","following_url":"https://api.github.com/users/japaric/following{/other_user}","gists_url":"https://api.github.com/users/japaric/gists{/gist_id}","starred_url":"https://api.github.com/users/japaric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/japaric/subscriptions","organizations_url":"https://api.github.com/users/japaric/orgs","repos_url":"https://api.github.com/users/japaric/repos","events_url":"https://api.github.com/users/japaric/events{/privacy}","received_events_url":"https://api.github.com/users/japaric/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/japaric/rfcs","description":"RFCs for changes to Rust","fork":true,"url":"https://api.github.com/repos/japaric/rfcs","forks_url":"https://api.github.com/repos/japaric/rfcs/forks","keys_url":"https://api.github.com/repos/japaric/rfcs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/japaric/rfcs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/japaric/rfcs/teams","hooks_url":"https://api.github.com/repos/japaric/rfcs/hooks","issue_events_url":"https://api.github.com/repos/japaric/rfcs/issues/events{/number}","events_url":"https://api.github.com/repos/japaric/rfcs/events","assignees_url":"https://api.github.com/repos/japaric/rfcs/assignees{/user}","branches_url":"https://api.github.com/repos/japaric/rfcs/branches{/branch}","tags_url":"https://api.github.com/repos/japaric/rfcs/tags","blobs_url":"https://api.github.com/repos/japaric/rfcs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/japaric/rfcs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/japaric/rfcs/git/refs{/sha}","trees_url":"https://api.github.com/repos/japaric/rfcs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/japaric/rfcs/statuses/{sha}","languages_url":"https://api.github.com/repos/japaric/rfcs/languages","stargazers_url":"https://api.github.com/repos/japaric/rfcs/stargazers","contributors_url":"https://api.github.com/repos/japaric/rfcs/contributors","subscribers_url":"https://api.github.com/repos/japaric/rfcs/subscribers","subscription_url":"https://api.github.com/repos/japaric/rfcs/subscription","commits_url":"https://api.github.com/repos/japaric/rfcs/commits{/sha}","git_commits_url":"https://api.github.com/repos/japaric/rfcs/git/commits{/sha}","comments_url":"https://api.github.com/repos/japaric/rfcs/comments{/number}","issue_comment_url":"https://api.github.com/repos/japaric/rfcs/issues/comments{/number}","contents_url":"https://api.github.com/repos/japaric/rfcs/contents/{+path}","compare_url":"https://api.github.com/repos/japaric/rfcs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/japaric/rfcs/merges","archive_url":"https://api.github.com/repos/japaric/rfcs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/japaric/rfcs/downloads","issues_url":"https://api.github.com/repos/japaric/rfcs/issues{/number}","pulls_url":"https://api.github.com/repos/japaric/rfcs/pulls{/number}","milestones_url":"https://api.github.com/repos/japaric/rfcs/milestones{/number}","notifications_url":"https://api.github.com/repos/japaric/rfcs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/japaric/rfcs/labels{/name}","releases_url":"https://api.github.com/repos/japaric/rfcs/releases{/id}","created_at":"2014-08-21T01:16:57Z","updated_at":"2015-05-14T05:01:01Z","pushed_at":"2015-05-19T23:30:51Z","git_url":"git://github.com/japaric/rfcs.git","ssh_url":"git@github.com:japaric/rfcs.git","clone_url":"https://github.com/japaric/rfcs.git","svn_url":"https://github.com/japaric/rfcs","homepage":"","size":1869,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"4bd1848f32c3d2afe5685f9f9cb5cee9412323d7","user":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":17527989,"name":"rfcs","full_name":"rust-lang/rfcs","owner":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-lang/rfcs","description":"RFCs for changes to Rust","fork":false,"url":"https://api.github.com/repos/rust-lang/rfcs","forks_url":"https://api.github.com/repos/rust-lang/rfcs/forks","keys_url":"https://api.github.com/repos/rust-lang/rfcs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rfcs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rfcs/teams","hooks_url":"https://api.github.com/repos/rust-lang/rfcs/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rfcs/events","assignees_url":"https://api.github.com/repos/rust-lang/rfcs/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rfcs/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rfcs/tags","blobs_url":"https://api.github.com/repos/rust-lang/rfcs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rfcs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rfcs/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rfcs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rfcs/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rfcs/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rfcs/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rfcs/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rfcs/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rfcs/subscription","commits_url":"https://api.github.com/repos/rust-lang/rfcs/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rfcs/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments{/number}","contents_url":"https://api.github.com/repos/rust-lang/rfcs/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rfcs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rfcs/merges","archive_url":"https://api.github.com/repos/rust-lang/rfcs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rfcs/downloads","issues_url":"https://api.github.com/repos/rust-lang/rfcs/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rfcs/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rfcs/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rfcs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rfcs/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rfcs/releases{/id}","created_at":"2014-03-07T21:29:00Z","updated_at":"2015-05-20T01:50:55Z","pushed_at":"2015-05-20T01:58:09Z","git_url":"git://github.com/rust-lang/rfcs.git","ssh_url":"git@github.com:rust-lang/rfcs.git","clone_url":"https://github.com/rust-lang/rfcs.git","svn_url":"https://github.com/rust-lang/rfcs","homepage":"","size":11928,"stargazers_count":361,"watchers_count":361,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":203,"mirror_url":null,"open_issues_count":511,"forks":203,"open_issues":511,"watchers":361,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/1129"},"html":{"href":"https://github.com/rust-lang/rfcs/pull/1129"},"issue":{"href":"https://api.github.com/repos/rust-lang/rfcs/issues/1129"},"comments":{"href":"https://api.github.com/repos/rust-lang/rfcs/issues/1129/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/1129/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/1129/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rfcs/statuses/b95ae6b514cd3f21fa77c46c59c7a9a3e755da45"}}}}