{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/10140","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/10140/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/10140/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/10140/events","html_url":"https://github.com/JuliaLang/julia/issues/10140","id":57091015,"number":10140,"title":"Reinterpret immutables","user":{"login":"SimonDanisch","id":1010467,"avatar_url":"https://avatars.githubusercontent.com/u/1010467?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonDanisch","html_url":"https://github.com/SimonDanisch","followers_url":"https://api.github.com/users/SimonDanisch/followers","following_url":"https://api.github.com/users/SimonDanisch/following{/other_user}","gists_url":"https://api.github.com/users/SimonDanisch/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonDanisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonDanisch/subscriptions","organizations_url":"https://api.github.com/users/SimonDanisch/orgs","repos_url":"https://api.github.com/users/SimonDanisch/repos","events_url":"https://api.github.com/users/SimonDanisch/events{/privacy}","received_events_url":"https://api.github.com/users/SimonDanisch/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/codegen","name":"codegen","color":"d4c5f9"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/won't%20fix","name":"won't fix","color":"e10c02"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-02-09T21:16:42Z","updated_at":"2016-03-26T19:48:01Z","closed_at":"2016-03-25T20:03:03Z","body":"I was wondering, why this works:\r\n```Julia\r\nreinterpret(Float32, Int32(0))\r\n@assert isbits(ImmutableType1) && isbits(ImmutableType2) && (sizeof(ImmutableType1) == sizeof(ImmutableType2)) \r\nreinterpret(ImmutableType1, Array(ImmutableType2, 42))\r\n```\r\nand this does not:\r\n```Julia\r\nreinterpret(ImmutableType1, ImmutableType2(...))\r\n```\r\nThis is convenient for converting different FixedSizeArrays with the same layout without copying anything.\r\nIt's probably related to #7697, which didn't get fully implemented?\r\n\r\n@vtjnash answered on Julia users:\r\n> That last one requires a different sequence of llvm instructions than the other examples (it's the difference between isbits and bitstype). Not hard, but likely unimplemented. \r\n\r\nIs anyone willing to implement this, or give some pointers on how to implement it?"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/201919222","html_url":"https://github.com/JuliaLang/julia/issues/10140#issuecomment-201919222","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/10140","id":201919222,"user":{"login":"vtjnash","id":330950,"avatar_url":"https://avatars.githubusercontent.com/u/330950?v=3","gravatar_id":"","url":"https://api.github.com/users/vtjnash","html_url":"https://github.com/vtjnash","followers_url":"https://api.github.com/users/vtjnash/followers","following_url":"https://api.github.com/users/vtjnash/following{/other_user}","gists_url":"https://api.github.com/users/vtjnash/gists{/gist_id}","starred_url":"https://api.github.com/users/vtjnash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vtjnash/subscriptions","organizations_url":"https://api.github.com/users/vtjnash/orgs","repos_url":"https://api.github.com/users/vtjnash/repos","events_url":"https://api.github.com/users/vtjnash/events{/privacy}","received_events_url":"https://api.github.com/users/vtjnash/received_events","type":"User","site_admin":false},"created_at":"2016-03-26T19:48:01Z","updated_at":"2016-03-26T19:48:01Z","body":"tl;dr; it's safe for the common workflows, but there may be opportunities here to support the desired operations with more careful primitives"}}