{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/19313","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/19313/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/19313/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/19313/events","html_url":"https://github.com/JuliaLang/julia/issues/19313","id":188972564,"number":19313,"title":"Element-wise call syntax does not always lower to standard broadcast()","user":{"login":"nalimilan","id":1120448,"avatar_url":"https://avatars.githubusercontent.com/u/1120448?v=3","gravatar_id":"","url":"https://api.github.com/users/nalimilan","html_url":"https://github.com/nalimilan","followers_url":"https://api.github.com/users/nalimilan/followers","following_url":"https://api.github.com/users/nalimilan/following{/other_user}","gists_url":"https://api.github.com/users/nalimilan/gists{/gist_id}","starred_url":"https://api.github.com/users/nalimilan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nalimilan/subscriptions","organizations_url":"https://api.github.com/users/nalimilan/orgs","repos_url":"https://api.github.com/users/nalimilan/repos","events_url":"https://api.github.com/users/nalimilan/events{/privacy}","received_events_url":"https://api.github.com/users/nalimilan/received_events","type":"User","site_admin":false},"labels":[{"id":418435319,"url":"https://api.github.com/repos/JuliaLang/julia/labels/vectorization","name":"vectorization","color":"1d76db","default":false},{"id":4103824,"url":"https://api.github.com/repos/JuliaLang/julia/labels/won't%20fix","name":"won't fix","color":"e10c02","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-11-13T14:17:47Z","updated_at":"2016-11-14T16:53:51Z","closed_at":null,"body":"It appears that some simple uses of the element-wise call syntax `.(` are not lowered to a standard `broadcast` call. This is a problem for `NullableArray` where we would like to overload `broadcast` to apply lifting semantics (https://github.com/JuliaStats/NullableArrays.jl/pull/166).\r\n\r\nFor example, the following code doesn't call `broadcast(get, X, 0)`. Therefore it fails since my custom `broadcast` function has a special behavior for `get` which doesn't get triggered here.\r\n\r\nWhy it this the case?\r\n\r\n```julia\r\n\r\njulia> expand(:(get.([Nullable()], 0)))\r\n:($(Expr(:thunk, CodeInfo(:(begin \r\n        $(Expr(:thunk, CodeInfo(:(begin \r\n        global ##3#4\r\n        const ##3#4\r\n        $(Expr(:composite_type, Symbol(\"##3#4\"), :((Core.svec)()), :((Core.svec)()), :(Core.Function), :((Core.svec)()), false, 0))\r\n        return\r\n    end))))\r\n        $(Expr(:method, false, :((Core.svec)((Core.svec)(##3#4,Any),(Core.svec)())), CodeInfo(:(begin \r\n        return get(#temp#,0)\r\n    end)), false))\r\n        #3 = $(Expr(:new, Symbol(\"##3#4\")))\r\n        SSAValue(0) = #3\r\n        SSAValue(1) = (Base.vect)(Nullable())\r\n        return (Base.broadcast)(SSAValue(0),SSAValue(1))\r\n    end)))))\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/260392124","html_url":"https://github.com/JuliaLang/julia/issues/19313#issuecomment-260392124","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/19313","id":260392124,"user":{"login":"nalimilan","id":1120448,"avatar_url":"https://avatars.githubusercontent.com/u/1120448?v=3","gravatar_id":"","url":"https://api.github.com/users/nalimilan","html_url":"https://github.com/nalimilan","followers_url":"https://api.github.com/users/nalimilan/followers","following_url":"https://api.github.com/users/nalimilan/following{/other_user}","gists_url":"https://api.github.com/users/nalimilan/gists{/gist_id}","starred_url":"https://api.github.com/users/nalimilan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nalimilan/subscriptions","organizations_url":"https://api.github.com/users/nalimilan/orgs","repos_url":"https://api.github.com/users/nalimilan/repos","events_url":"https://api.github.com/users/nalimilan/events{/privacy}","received_events_url":"https://api.github.com/users/nalimilan/received_events","type":"User","site_admin":false},"created_at":"2016-11-14T16:53:51Z","updated_at":"2016-11-14T16:53:51Z","body":"That would work. Though strictly speaking loops can fuse, it's just that we need to be able to transform the function if needed before fusing it. That is, something like:\r\n```julia\r\nf.(g.(x...)) --> broadcast(_ -> maybe_lift(f, maybe_lift(g, _...)), x...)\r\n```\r\nwith\r\n```julia\r\nmaybe_lift(f, _...) = f(_...)\r\n```\r\nfor non-lifted functions (the current case).\r\n\r\nOf course we can always define special methods instead of using the dot syntax. But I prefer trying to push the logic as far as possible to see all implications and (in)consistency of the design choice first."}}
{"actor":{"display_login":"nalimilan"}}