{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaArrays/StaticArrays.jl/issues/24","repository_url":"https://api.github.com/repos/JuliaArrays/StaticArrays.jl","labels_url":"https://api.github.com/repos/JuliaArrays/StaticArrays.jl/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/JuliaArrays/StaticArrays.jl/issues/24/comments","events_url":"https://api.github.com/repos/JuliaArrays/StaticArrays.jl/issues/24/events","html_url":"https://github.com/JuliaArrays/StaticArrays.jl/issues/24","id":175012669,"number":24,"title":"Naming for small vectors","user":{"login":"c42f","id":601473,"avatar_url":"https://avatars.githubusercontent.com/u/601473?v=3","gravatar_id":"","url":"https://api.github.com/users/c42f","html_url":"https://github.com/c42f","followers_url":"https://api.github.com/users/c42f/followers","following_url":"https://api.github.com/users/c42f/following{/other_user}","gists_url":"https://api.github.com/users/c42f/gists{/gist_id}","starred_url":"https://api.github.com/users/c42f/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c42f/subscriptions","organizations_url":"https://api.github.com/users/c42f/orgs","repos_url":"https://api.github.com/users/c42f/repos","events_url":"https://api.github.com/users/c42f/events{/privacy}","received_events_url":"https://api.github.com/users/c42f/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":45,"created_at":"2016-09-05T07:42:38Z","updated_at":"2016-12-20T23:50:20Z","closed_at":null,"body":"As discussed at https://github.com/SimonDanisch/FixedSizeArrays.jl/issues/159, I rather liked writing `Vec` and `Mat` for small sized arrays in FixedSizeArrays.  Perhaps we should try to recover these names for StaticArrays, perhaps not?\n\nNote that SIMD.jl has also started using Vec so there is unfortunately already a naming clash with FixedSizeArrays there @eschnett\n"},"comment":{"url":"https://api.github.com/repos/JuliaArrays/StaticArrays.jl/issues/comments/268393187","html_url":"https://github.com/JuliaArrays/StaticArrays.jl/issues/24#issuecomment-268393187","issue_url":"https://api.github.com/repos/JuliaArrays/StaticArrays.jl/issues/24","id":268393187,"user":{"login":"andyferris","id":2974526,"avatar_url":"https://avatars.githubusercontent.com/u/2974526?v=3","gravatar_id":"","url":"https://api.github.com/users/andyferris","html_url":"https://github.com/andyferris","followers_url":"https://api.github.com/users/andyferris/followers","following_url":"https://api.github.com/users/andyferris/following{/other_user}","gists_url":"https://api.github.com/users/andyferris/gists{/gist_id}","starred_url":"https://api.github.com/users/andyferris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyferris/subscriptions","organizations_url":"https://api.github.com/users/andyferris/orgs","repos_url":"https://api.github.com/users/andyferris/repos","events_url":"https://api.github.com/users/andyferris/events{/privacy}","received_events_url":"https://api.github.com/users/andyferris/received_events","type":"User","site_admin":false},"created_at":"2016-12-20T23:50:20Z","updated_at":"2016-12-20T23:50:20Z","body":"> But it's sad it cannot be used for comprehensions... `S[i for i=1:3]`\r\n\r\nRight... lowering of comprehensions is extremely direct to becoming an array:\r\n\r\n```\r\njulia> f() = S[i for i=1:3]\r\nf (generic function with 1 method)\r\n\r\njulia> @code_lowered f()\r\nLambdaInfo template for f() at REPL[1]:1\r\n:(begin \r\n        nothing\r\n        SSAValue(0) = (Main.colon)(1,3)\r\n        SSAValue(1) = (Base.length)(SSAValue(0))\r\n        SSAValue(2) = (Core.Array)(Main.S,SSAValue(1))\r\n        #temp#@_2 = 1\r\n        #temp#@_3 = (Base.start)(SSAValue(0))\r\n        #temp#@_4 = (Core.typeassert)((Base.convert)((Core.typeof)(SSAValue(1)),0),(Core.typeof)(SSAValue(1)))\r\n        8: \r\n        unless #temp#@_4 != SSAValue(1) goto 27\r\n        SSAValue(3) = #temp#@_4 + 1\r\n        #temp#@_4 = (Core.typeassert)((Base.convert)((Core.typeof)(SSAValue(1)),SSAValue(3)),(Core.typeof)(SSAValue(1)))\r\n        SSAValue(4) = (Base.next)(SSAValue(0),#temp#@_3)\r\n        #temp#@_6 = (Base.start)(SSAValue(4))\r\n        SSAValue(5) = (Base.indexed_next)(SSAValue(4),1,#temp#@_6)\r\n        i = (Core.getfield)(SSAValue(5),1)\r\n        #temp#@_6 = (Core.getfield)(SSAValue(5),2)\r\n        SSAValue(6) = (Base.indexed_next)(SSAValue(4),2,#temp#@_6)\r\n        #temp#@_3 = (Core.getfield)(SSAValue(6),1)\r\n        #temp#@_6 = (Core.getfield)(SSAValue(6),2)\r\n        SSAValue(7) = i\r\n        $(Expr(:inbounds, true))\r\n        (Base.setindex!)(SSAValue(2),SSAValue(7),#temp#@_2)\r\n        $(Expr(:inbounds, :pop))\r\n        #temp#@_2 = #temp#@_2 + 1\r\n        25: \r\n        goto 8\r\n        27: \r\n        return SSAValue(2)\r\n    end)\r\n```\r\nThe things you learn. On the other hand we can do\r\n```\r\njulia> f() = S[(i for i=1:3)]\r\nWARNING: Method definition f() in module Main at REPL[1]:1 overwritten at REPL[4]:1.\r\nf (generic function with 1 method)\r\n\r\njulia> @code_lowered f()\r\nLambdaInfo template for f() at REPL[4]:1\r\n:(begin \r\n        nothing\r\n        SSAValue(0) = Main.S\r\n        #1 = $(Expr(:new, :(Main.##1#2)))\r\n        SSAValue(1) = #1\r\n        SSAValue(2) = (Main.colon)(1,3)\r\n        SSAValue(3) = (Base.Generator)(SSAValue(1),SSAValue(2))\r\n        return (Main.getindex)(SSAValue(0),SSAValue(3))\r\n    end)\r\n```\r\nand so could overload `getindex(::Type{S}, ::Generator)`...\r\n\r\nThe only thing I'm worried about is that inference will not treat not treat the `Generator` as `Const` (because `colon` is not marked `@pure` and most functions in the generators will capture local variables). However, a future version of Julia with improved inference/inlining might be able to get around *all* of these issues, but for now that's out."}}
{"actor":{"display_login":"andyferris"}}