Skip to content
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

Merged
merged 1 commit into from
Jun 29, 2018
Merged

update deprecations for init kwarg #27862

merged 1 commit into from
Jun 29, 2018

Conversation

fredrikekre
Copy link
Member

@fredrikekre fredrikekre commented Jun 29, 2018

Updated the deprecations, and adds deprecations for the old methods for people that have already adopted the new code (it currently errors).

@fredrikekre fredrikekre added the deprecation This change introduces or involves a deprecation label Jun 29, 2018
Copy link
Member

@andyferris andyferris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea.

@fredrikekre fredrikekre merged commit f60d79e into master Jun 29, 2018
@fredrikekre fredrikekre deleted the fe/v0 branch June 29, 2018 12:46
@@ -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)
Copy link
Member

@rfourquet rfourquet Jun 29, 2018

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.

Copy link
Sponsor Member

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

Copy link
Member Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation This change introduces or involves a deprecation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants