Skip to content

Commit

Permalink
add depwarn for using .+ etc as function objects
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Sep 21, 2016
1 parent 47e8eca commit b23c2f9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1000,4 +1000,18 @@ macro vectorize_2arg(S,f)
end
export @vectorize_1arg, @vectorize_2arg

# deprecations for uses of old dot operators (.* etc) as objects, rather than
# just calling them infix.
for op in (:(!=), :, :+, :-, :*, :/, :÷, :%, :<, :(<=), :, :(==), :>, :>=, :, :\, :^)
dotop = Symbol(string('.', op))
# define as const dotop = (a,b) -> ...
# to work around syntax deprecation for dotop(a,b) = ...
@eval const $dotop = (a,b) -> begin
depwarn(string($(string(dotop)), " is no longer a function object; use broadcast(",$op,", ...) instead"),
$(QuoteNode(dotop)))
broadcast($op, a, b)
end
@eval export $dotop
end

# End deprecations scheduled for 0.6

0 comments on commit b23c2f9

Please sign in to comment.