-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update deprecations for init kwarg #27862
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea.
@@ -1722,6 +1722,9 @@ end | |||
@deprecate mapreduce(f, op, v0, itr) mapreduce(f, op, itr; init=v0) | |||
@deprecate mapfoldl(f, op, v0, itr) mapfoldl(f, op, itr; init=v0) | |||
@deprecate mapfoldr(f, op, v0, itr) mapfoldr(f, op, itr; init=v0) | |||
# also deprecate the old deprecations | |||
@deprecate mapreduce(f, op, v0, A; dims=dims) mapreduce(f, op, A; init = v0, dims=dims) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this definition overwrites the one 4 lines above, as there is no dispatch on keywords (I also made the same kind of mistake a couple of times!). While compiling julia, there is a message that mapreduce
and reduce
are overwriten. The problem is that now I get an error message in a package using mapreduce
that dims
is not defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too:
julia> reduce(+, 0, [1,2,3])
ERROR: UndefVarError: dims not defined
Stacktrace:
[1] reduce(::Function, ::Int64, ::Array{Int64,1}) at ./deprecated.jl:54
[2] top-level scope at none:0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, is there no way to do this then? I'll have a look, sorry!
Updated the deprecations, and adds deprecations for the old methods for people that have already adopted the new code (it currently errors).