{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/20418","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/20418/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/20418/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/20418/events","html_url":"https://github.com/JuliaLang/julia/pull/20418","id":205014716,"number":20418,"title":"use `abstract|primitive type`, `struct`, `mutable struct` for type definitions","user":{"login":"JeffBezanson","id":744556,"avatar_url":"https://avatars.githubusercontent.com/u/744556?v=3","gravatar_id":"","url":"https://api.github.com/users/JeffBezanson","html_url":"https://github.com/JeffBezanson","followers_url":"https://api.github.com/users/JeffBezanson/followers","following_url":"https://api.github.com/users/JeffBezanson/following{/other_user}","gists_url":"https://api.github.com/users/JeffBezanson/gists{/gist_id}","starred_url":"https://api.github.com/users/JeffBezanson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeffBezanson/subscriptions","organizations_url":"https://api.github.com/users/JeffBezanson/orgs","repos_url":"https://api.github.com/users/JeffBezanson/repos","events_url":"https://api.github.com/users/JeffBezanson/events{/privacy}","received_events_url":"https://api.github.com/users/JeffBezanson/received_events","type":"User","site_admin":false},"labels":[{"id":1363386,"url":"https://api.github.com/repos/JuliaLang/julia/labels/breaking","name":"breaking","color":"800000","default":false},{"id":371587497,"url":"https://api.github.com/repos/JuliaLang/julia/labels/design","name":"design","color":"e99695","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/JuliaLang/julia/milestones/20","html_url":"https://github.com/JuliaLang/julia/milestone/20","labels_url":"https://api.github.com/repos/JuliaLang/julia/milestones/20/labels","id":1298021,"number":20,"title":"0.6.0","description":"","creator":{"login":"JeffBezanson","id":744556,"avatar_url":"https://avatars.githubusercontent.com/u/744556?v=3","gravatar_id":"","url":"https://api.github.com/users/JeffBezanson","html_url":"https://github.com/JeffBezanson","followers_url":"https://api.github.com/users/JeffBezanson/followers","following_url":"https://api.github.com/users/JeffBezanson/following{/other_user}","gists_url":"https://api.github.com/users/JeffBezanson/gists{/gist_id}","starred_url":"https://api.github.com/users/JeffBezanson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeffBezanson/subscriptions","organizations_url":"https://api.github.com/users/JeffBezanson/orgs","repos_url":"https://api.github.com/users/JeffBezanson/repos","events_url":"https://api.github.com/users/JeffBezanson/events{/privacy}","received_events_url":"https://api.github.com/users/JeffBezanson/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":218,"state":"open","created_at":"2015-09-09T16:35:16Z","updated_at":"2017-02-07T19:18:39Z","due_on":"2017-02-28T08:00:00Z","closed_at":null},"comments":69,"created_at":"2017-02-02T22:22:39Z","updated_at":"2017-02-08T01:05:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/20418","html_url":"https://github.com/JuliaLang/julia/pull/20418","diff_url":"https://github.com/JuliaLang/julia/pull/20418.diff","patch_url":"https://github.com/JuliaLang/julia/pull/20418.patch"},"body":"Fixes #19157.\r\n\r\nThis regularizes the type-defining keywords and makes them more accurately descriptive. The proposed syntax is\r\n\r\n```\r\nabstract type Integer <: Real end\r\nprimitive type Int32 <: Signed 32 end\r\nstruct Complex ... end\r\nmutable struct Ref ... end\r\n```\r\n\r\nThis is nicely extensible for the future, avoids stealing the words abstract, primitive, and (im)mutable as keywords, and as a bonus supports Compat.\r\n\r\n1. We should use the word `struct`; previously there was no keyword that described what the most common kind of user-defined type actually was.\r\n2. We should steer people to immutable types by default. Immutable is generally better and faster, has better default behavior with `===`, and it's really pretty rare to need to update object fields. Base has many more immutable types than mutable, and in making this change it seemed to me that even more types could be made immutable. But `type Foo` looks more natural than `immutable Foo`, so `type` tends to be the default choice. This change reverses that, with `struct Foo` being more natural, and immutable. Writing `mutable struct Foo` makes you ask \"does this really need to be mutable?\", which is a good thing!\r\n3. Immutable struct types are the closest thing we have to value type structs in other languages. We inline them in arrays in at least some cases, and being immutable makes it much harder to tell whether they are value or reference types.\r\n4. FWIW, Rust also uses `struct` and makes them immutable. Not that we need to copy Rust, but it adds confidence that this is a reasonable thing to do.\r\n5. We could eventually phase out mutable structs, and instead use `Ref` fields where needed in immutable structs.\r\n\r\nSo far I really like the way this change looks. `immutable` is kind of a long and ugly word.\r\n\r\nThe deprecation warning gives line numbers.\r\n\r\nI haven't updated the manual yet. I think we'll want to reorganize it a bit to introduce immutable structs first."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/278196890","html_url":"https://github.com/JuliaLang/julia/pull/20418#issuecomment-278196890","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/20418","id":278196890,"user":{"login":"swissr","id":93920,"avatar_url":"https://avatars.githubusercontent.com/u/93920?v=3","gravatar_id":"","url":"https://api.github.com/users/swissr","html_url":"https://github.com/swissr","followers_url":"https://api.github.com/users/swissr/followers","following_url":"https://api.github.com/users/swissr/following{/other_user}","gists_url":"https://api.github.com/users/swissr/gists{/gist_id}","starred_url":"https://api.github.com/users/swissr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swissr/subscriptions","organizations_url":"https://api.github.com/users/swissr/orgs","repos_url":"https://api.github.com/users/swissr/repos","events_url":"https://api.github.com/users/swissr/events{/privacy}","received_events_url":"https://api.github.com/users/swissr/received_events","type":"User","site_admin":false},"created_at":"2017-02-08T01:05:51Z","updated_at":"2017-02-08T01:05:51Z","body":"> really need to have end\r\n\r\nIMHO primitive looks good with an end; abstract, well you are right, but when there is a type there might as well be an end... and then all four types have the same (block) form. Also, `abstract` and especially `primitive` are not used (too) often. Very subjective: after having looked at quite some code with adapted syntax highlighter my initial 'two-keyword-aesthetic-fear' has gone away. Huge improvement!! Much clearer. A struct is a `struct` and no longer an unspecified everything type. `type` just an ordinary variable, who would have thought? bitstype now reads almost like normal english:\r\n`primitive type Int16   <: Signed   16 end`.\r\n\r\n...could have been worse 😋"}}
{"actor":{"display_login":"swissr"}}