{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/30123","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/30123/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/30123/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/30123/events","html_url":"https://github.com/JuliaLang/julia/issues/30123","id":383636668,"node_id":"MDU6SXNzdWUzODM2MzY2Njg=","number":30123,"title":"using (U)Int32 on 64-bit machines very awkward. ","user":{"login":"Orbots","id":3904503,"node_id":"MDQ6VXNlcjM5MDQ1MDM=","avatar_url":"https://avatars1.githubusercontent.com/u/3904503?v=4","gravatar_id":"","url":"https://api.github.com/users/Orbots","html_url":"https://github.com/Orbots","followers_url":"https://api.github.com/users/Orbots/followers","following_url":"https://api.github.com/users/Orbots/following{/other_user}","gists_url":"https://api.github.com/users/Orbots/gists{/gist_id}","starred_url":"https://api.github.com/users/Orbots/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Orbots/subscriptions","organizations_url":"https://api.github.com/users/Orbots/orgs","repos_url":"https://api.github.com/users/Orbots/repos","events_url":"https://api.github.com/users/Orbots/events{/privacy}","received_events_url":"https://api.github.com/users/Orbots/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2018-11-22T19:00:58Z","updated_at":"2018-11-23T23:13:59Z","closed_at":"2018-11-22T23:33:45Z","author_association":"NONE","body":"I've read #9162 and understand the rational.\r\n\r\nThe awkwardness stems mostly from integer literals being 64 bit.   For high performance real-time, memory limited or  embedded systems you often do want to work with 32-bit integers.  Games development is an example use-case.  Additionally this type of code would tend to use a lot of integer literals.  I've been doing things like `x + UInt32(1)` or defining constants like `const three = UInt32(3)`  ugly.  My code has UInt32 casts everywhere!  At least with floats I can write `3.0f0`.  `0x00003` is not so nice. \r\n\r\nI'd be happiest if integer literals could demote to match the other type(s) in a given operator, but I guess then your going to need a new type for literals or something.  I can see this being complicated and fraught with peril.\r\n\r\nSecond happiest would be a more convenient way of entering 32-bit integer literals. \r\n\r\n    julia> typeof(UInt32(1) + 1)\r\n    Int64\r\n\r\nAlso why is that not UInt64?  Seems inconsistent.\r\n\r\n    julia> typeof(UInt64(1) + 1)\r\n    UInt64\r\n"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/441328463","html_url":"https://github.com/JuliaLang/julia/issues/30123#issuecomment-441328463","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/30123","id":441328463,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTMyODQ2Mw==","user":{"login":"Orbots","id":3904503,"node_id":"MDQ6VXNlcjM5MDQ1MDM=","avatar_url":"https://avatars1.githubusercontent.com/u/3904503?v=4","gravatar_id":"","url":"https://api.github.com/users/Orbots","html_url":"https://github.com/Orbots","followers_url":"https://api.github.com/users/Orbots/followers","following_url":"https://api.github.com/users/Orbots/following{/other_user}","gists_url":"https://api.github.com/users/Orbots/gists{/gist_id}","starred_url":"https://api.github.com/users/Orbots/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Orbots/subscriptions","organizations_url":"https://api.github.com/users/Orbots/orgs","repos_url":"https://api.github.com/users/Orbots/repos","events_url":"https://api.github.com/users/Orbots/events{/privacy}","received_events_url":"https://api.github.com/users/Orbots/received_events","type":"User","site_admin":false},"created_at":"2018-11-23T23:13:59Z","updated_at":"2018-11-23T23:13:59Z","author_association":"NONE","body":"@StefanKarpinski it partially addresses the problem of conveniently creating 32-bit literals.  Does it address the problem of working with 32-bit ints being awkward in general?  Not really.\r\n\r\n    julia> foo(x::UInt32) = x*x\r\n    foo (generic function with 1 method)\r\n\r\n    julia> foo(1)\r\n    ERROR: MethodError: no method matching foo(::Int64)  \r\n    Closest candidates are:\r\n      foo(::UInt32) at REPL[1]:1  # **a little awkward** but error message is informative, so not too bad\r\n    Stacktrace:\r\n     [1] top-level scope at none:0\r\n    \r\n    julia> let\r\n               two::UInt32 = 2  # this is ok\r\n               foo( two + two )\r\n             end\r\n    0x00000010   # **awkward**\r\n\r\n    julia> two::UInt32 = 2   \r\n    #**awkward**\r\n    ERROR: syntax: type declarations on global variables are not yet supported\r\n\r\n    julia> let\r\n                two::UInt32 = 2\r\n                foo( two +  3 ) \r\n       end\r\n    ERROR: MethodError: no method matching foo(::Int64)\r\n     # oops, forgot to declare three... **a little awkward** but not horrible.\r\n"}}
{"actor":{"display_login":"Orbots"}}