GitHub PullRequestReviewCommentEvent at 2014-11-26 04:21:03
Repository: rfcs
Actor: bstrie
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments/20915800","id":20915800,"diff_hunk":"@@ -0,0 +1,114 @@\n+- Start Date: 2014-11-25\n+- RFC PR:\n+- Rust Issue:\n+\n+# Summary\n+\n+Change attribute syntax from `#[foo]` and `#![foo]` to `@foo` and `@!foo`.\n+\n+# Motivation\n+\n+Other languages like Java and Python use `@` for their equivalents of\n+attributes. In addition, `@foo` is easier to type than `#[foo]`, and is\n+arguably less noisy looking.\n+\n+This change was proposed as part of [RFC\n+386](https://github.com/rust-lang/rfcs/pull/386/files) and was generally\n+well-received.\n+\n+# Detailed design\n+\n+Attributes and inner attributes would be written in one of the following forms\n+(BNF):\n+\n+```\n+ATTR       = '@' [!] META\n+           | '@' [!] '[' META ']'\n+META       = ID\n+           | ID '(' META_SEQ ')'\n+META_SEQ   = META_ITEM {',' META_ITEM}\n+META_ITEM  = META\n+           | ID '=' STRING_LITERAL\n+```\n+\n+Here are some examples of legal syntax:\n+\n+* `@inline`\n+* `@!inline`\n+* `@[inline]`\n+* `@deprecated(reason = \"foo\")`\n+* `@deriving(Eq)`\n+\n+Note that some attributes which are legal today have no equivalent:\n+\n+* `#[deprecated = \"foo\"]` becomes `@deprecated(reason = \"foo\")`\n+\n+`[]` delimiters are allowed but not required. They are necessary to avoid\n+mis-parses in certain situations:\n+```rust\n+match (foo, bar) {\n+    @thing\n+    (a, b) => { ...}\n+    ...\n+}\n+```\n+This will parse as the attribute `@thing(a, b)`, which will in turn result in\n+a syntax error. `[]` delimiters will resolve the ambiguity:\n+```rust\n+match (foo, bar) {\n+    @[thing]\n+    (a, b) => { ...}\n+    ...\n+}\n+```\n+\n+## Implementation\n+\n+The parser will be adjusted to accept `@`-attributes in addition to current\n+attributes. The internal data structures will remain the same. Once a snapshot\n+lands, the Rust codebase can be converted, and parsing support for\n+`#`-attributes can be removed with an error message added explaining how to fix\n+code.\n+\n+# Drawbacks\n+\n+It's a large change that will cause a ton of churn very close to 1.0. Since the\n+only compiler changes required will be to the parser and pretty printer, it's\n+relatively low risk (compared to resolve or typeck changes for example).\n+\n+The need to continue to allow `[]` delimiters is a bit unfortunate.\n+\n+# Alternatives\n+\n+We can punt on this until after 1.0. `@`-attributes and `#`-attributes will\n+have to coexist to avoid breaking backwards compatibility, but that won't be\n+all that hard to deal with.\n+\n+We can leave the syntax as is, which is also not that bad.\n+\n+We could use `()` as the optional delimiters instead of `[]`.\n+\n+Support for `#[deprecated = \"reason\"]` style attributes is removed because\n+`@deprecated = \"reason\"` is a bit visually confusing since there are no\n+delimiters wrapping the attribute. There are a couple of alternatives here.\n+One is to just allow that syntax. It's not grammatically ambiguous, after all.","path":"text/0000-attribute-syntax.md","position":94,"original_position":94,"commit_id":"cc1afb1a35321f0caeda009ac99bf94feb966b98","original_commit_id":"cc1afb1a35321f0caeda009ac99bf94feb966b98","user":{"login":"bstrie","id":865233,"avatar_url":"https://avatars.githubusercontent.com/u/865233?v=3","gravatar_id":"","url":"https://api.github.com/users/bstrie","html_url":"https://github.com/bstrie","followers_url":"https://api.github.com/users/bstrie/followers","following_url":"https://api.github.com/users/bstrie/following{/other_user}","gists_url":"https://api.github.com/users/bstrie/gists{/gist_id}","starred_url":"https://api.github.com/users/bstrie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bstrie/subscriptions","organizations_url":"https://api.github.com/users/bstrie/orgs","repos_url":"https://api.github.com/users/bstrie/repos","events_url":"https://api.github.com/users/bstrie/events{/privacy}","received_events_url":"https://api.github.com/users/bstrie/received_events","type":"User","site_admin":false},"body":"Heartily against this alternative, this form is just noisier and less powerful.","created_at":"2014-11-26T04:21:03Z","updated_at":"2014-11-26T04:21:03Z","html_url":"https://github.com/rust-lang/rfcs/pull/483#discussion_r20915800","pull_request_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/483","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments/20915800"},"html":{"href":"https://github.com/rust-lang/rfcs/pull/483#discussion_r20915800"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/483"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/483","id":25049216,"html_url":"https://github.com/rust-lang/rfcs/pull/483","diff_url":"https://github.com/rust-lang/rfcs/pull/483.diff","patch_url":"https://github.com/rust-lang/rfcs/pull/483.patch","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/483","number":483,"state":"open","locked":false,"title":"Change attribute syntax to @foo","user":{"login":"sfackler","id":1455697,"avatar_url":"https://avatars.githubusercontent.com/u/1455697?v=3","gravatar_id":"","url":"https://api.github.com/users/sfackler","html_url":"https://github.com/sfackler","followers_url":"https://api.github.com/users/sfackler/followers","following_url":"https://api.github.com/users/sfackler/following{/other_user}","gists_url":"https://api.github.com/users/sfackler/gists{/gist_id}","starred_url":"https://api.github.com/users/sfackler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfackler/subscriptions","organizations_url":"https://api.github.com/users/sfackler/orgs","repos_url":"https://api.github.com/users/sfackler/repos","events_url":"https://api.github.com/users/sfackler/events{/privacy}","received_events_url":"https://api.github.com/users/sfackler/received_events","type":"User","site_admin":false},"body":"As with the enum thing, I can commit to pushing the impl through relatively quickly.\r\n\r\n[Rendered](https://github.com/sfackler/rfcs/blob/attr-syntax/text/0000-attribute-syntax.md)","created_at":"2014-11-25T23:21:36Z","updated_at":"2014-11-26T04:21:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f6e256000dbd349fef715441b79c7307c6742812","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/483/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/483/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/483/comments","statuses_url":"https://api.github.com/repos/rust-lang/rfcs/statuses/cc1afb1a35321f0caeda009ac99bf94feb966b98","head":{"label":"sfackler:attr-syntax","ref":"attr-syntax","sha":"cc1afb1a35321f0caeda009ac99bf94feb966b98","user":{"login":"sfackler","id":1455697,"avatar_url":"https://avatars.githubusercontent.com/u/1455697?v=3","gravatar_id":"","url":"https://api.github.com/users/sfackler","html_url":"https://github.com/sfackler","followers_url":"https://api.github.com/users/sfackler/followers","following_url":"https://api.github.com/users/sfackler/following{/other_user}","gists_url":"https://api.github.com/users/sfackler/gists{/gist_id}","starred_url":"https://api.github.com/users/sfackler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfackler/subscriptions","organizations_url":"https://api.github.com/users/sfackler/orgs","repos_url":"https://api.github.com/users/sfackler/repos","events_url":"https://api.github.com/users/sfackler/events{/privacy}","received_events_url":"https://api.github.com/users/sfackler/received_events","type":"User","site_admin":false},"repo":{"id":17653195,"name":"rfcs","full_name":"sfackler/rfcs","owner":{"login":"sfackler","id":1455697,"avatar_url":"https://avatars.githubusercontent.com/u/1455697?v=3","gravatar_id":"","url":"https://api.github.com/users/sfackler","html_url":"https://github.com/sfackler","followers_url":"https://api.github.com/users/sfackler/followers","following_url":"https://api.github.com/users/sfackler/following{/other_user}","gists_url":"https://api.github.com/users/sfackler/gists{/gist_id}","starred_url":"https://api.github.com/users/sfackler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfackler/subscriptions","organizations_url":"https://api.github.com/users/sfackler/orgs","repos_url":"https://api.github.com/users/sfackler/repos","events_url":"https://api.github.com/users/sfackler/events{/privacy}","received_events_url":"https://api.github.com/users/sfackler/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sfackler/rfcs","description":"RFCs for changes to Rust","fork":true,"url":"https://api.github.com/repos/sfackler/rfcs","forks_url":"https://api.github.com/repos/sfackler/rfcs/forks","keys_url":"https://api.github.com/repos/sfackler/rfcs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sfackler/rfcs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sfackler/rfcs/teams","hooks_url":"https://api.github.com/repos/sfackler/rfcs/hooks","issue_events_url":"https://api.github.com/repos/sfackler/rfcs/issues/events{/number}","events_url":"https://api.github.com/repos/sfackler/rfcs/events","assignees_url":"https://api.github.com/repos/sfackler/rfcs/assignees{/user}","branches_url":"https://api.github.com/repos/sfackler/rfcs/branches{/branch}","tags_url":"https://api.github.com/repos/sfackler/rfcs/tags","blobs_url":"https://api.github.com/repos/sfackler/rfcs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sfackler/rfcs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sfackler/rfcs/git/refs{/sha}","trees_url":"https://api.github.com/repos/sfackler/rfcs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sfackler/rfcs/statuses/{sha}","languages_url":"https://api.github.com/repos/sfackler/rfcs/languages","stargazers_url":"https://api.github.com/repos/sfackler/rfcs/stargazers","contributors_url":"https://api.github.com/repos/sfackler/rfcs/contributors","subscribers_url":"https://api.github.com/repos/sfackler/rfcs/subscribers","subscription_url":"https://api.github.com/repos/sfackler/rfcs/subscription","commits_url":"https://api.github.com/repos/sfackler/rfcs/commits{/sha}","git_commits_url":"https://api.github.com/repos/sfackler/rfcs/git/commits{/sha}","comments_url":"https://api.github.com/repos/sfackler/rfcs/comments{/number}","issue_comment_url":"https://api.github.com/repos/sfackler/rfcs/issues/comments/{number}","contents_url":"https://api.github.com/repos/sfackler/rfcs/contents/{+path}","compare_url":"https://api.github.com/repos/sfackler/rfcs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sfackler/rfcs/merges","archive_url":"https://api.github.com/repos/sfackler/rfcs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sfackler/rfcs/downloads","issues_url":"https://api.github.com/repos/sfackler/rfcs/issues{/number}","pulls_url":"https://api.github.com/repos/sfackler/rfcs/pulls{/number}","milestones_url":"https://api.github.com/repos/sfackler/rfcs/milestones{/number}","notifications_url":"https://api.github.com/repos/sfackler/rfcs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sfackler/rfcs/labels{/name}","releases_url":"https://api.github.com/repos/sfackler/rfcs/releases{/id}","created_at":"2014-03-12T02:50:13Z","updated_at":"2014-06-17T22:57:09Z","pushed_at":"2014-11-26T04:08:04Z","git_url":"git://github.com/sfackler/rfcs.git","ssh_url":"git@github.com:sfackler/rfcs.git","clone_url":"https://github.com/sfackler/rfcs.git","svn_url":"https://github.com/sfackler/rfcs","homepage":"","size":1202,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"63535c1d6cf077496108f9100a9bab36197f828d","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":"2014-11-24T00:11:52Z","pushed_at":"2014-11-25T23:58:56Z","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":9767,"stargazers_count":172,"watchers_count":172,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":121,"mirror_url":null,"open_issues_count":177,"forks":121,"open_issues":177,"watchers":172,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/483"},"html":{"href":"https://github.com/rust-lang/rfcs/pull/483"},"issue":{"href":"https://api.github.com/repos/rust-lang/rfcs/issues/483"},"comments":{"href":"https://api.github.com/repos/rust-lang/rfcs/issues/483/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/483/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/483/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rfcs/statuses/cc1afb1a35321f0caeda009ac99bf94feb966b98"}}}}