Skip to content

Conversation

@JeffBezanson
Copy link
Member

No description provided.

@nalimilan nalimilan requested a review from rfourquet January 5, 2018 22:28
@rfourquet
Copy link
Member

rfourquet commented Jan 6, 2018

Actually this is a good fix but to the wrong problem. As I said in the other issue, initially (in initial versions of #22324) we had something like replace!(prednew::Callable, A; count::Integer=typemax(Int)) = _replace!(prednew, A, Int(count)) and specific implementations had to specialize _replace!(::Callable, A::MyContainer, ::Int) (Int instead of Integer to limit the number of compiled functions, and a positional argument for count to work-around the slowness of forwarded keyword arguments). But Milan rightly suggested that it's nicer that implementations just have to specialize the real function replace! directly. So before merging, I updated this so that implementation have to specialize replace!(::Callable, A; count::Integer) or the same with count::Int, which both created the infinite loop reported in #25384 and actually broke slightly the fallback as it was intended, because dispatch on keywords doesn't work! E.g. in master replace!(x->2x, [1, 2]; count=0x1) errors out. So I will close this and open a PR which just gets rid of this too subtle Int vs Integer distinction, and add tests for when !(count isa Int).
(EDIT: and sorry for these bugs/confusion)

@rfourquet rfourquet closed this Jan 6, 2018
rfourquet added a commit that referenced this pull request Jan 6, 2018
`replace!` had one stack-overflow problem reported in #25384.
Its fix #25386 made a method-overwrite, tentatively fixed in #25422.
But `replace!` also didn't handle non-Int count arguments as
expected (because there is no dispatch on keyword arguments).
This fixes the root problem and adds tests for non-Int count.
@rfourquet rfourquet deleted the jb/replaceovf branch January 7, 2018 10:43
rfourquet added a commit that referenced this pull request Jan 7, 2018
`replace!` had one stack-overflow problem reported in #25384.
Its fix #25386 made a method-overwrite, tentatively fixed in #25422.
But `replace!` also didn't handle non-Int count arguments as
expected (because there is no dispatch on keyword arguments).
This fixes the root problem and adds tests for non-Int count.
rfourquet added a commit that referenced this pull request Jan 8, 2018
`replace!` had one stack-overflow problem reported in #25384.
Its fix #25386 made a method-overwrite, tentatively fixed in #25422.
But `replace!` also didn't handle non-Int count arguments as
expected (because there is no dispatch on keyword arguments).
This fixes the root problem and adds tests for non-Int count.
JeffBezanson pushed a commit that referenced this pull request Jan 8, 2018
`replace!` had one stack-overflow problem reported in #25384.
Its fix #25386 made a method-overwrite, tentatively fixed in #25422.
But `replace!` also didn't handle non-Int count arguments as
expected (because there is no dispatch on keyword arguments).
This fixes the root problem and adds tests for non-Int count.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants