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

Rework replace and replace! #26206

Merged
merged 4 commits into from
Apr 13, 2018
Merged

Rework replace and replace! #26206

merged 4 commits into from
Apr 13, 2018

Commits on Feb 26, 2018

  1. Rework replace and replace!

    Introduce a new replace!(new::Callable, res::T, A::T, count::Union{Nothing,Int}) method
    which custom types can implement to support all replace and replace! methods automatically,
    instead of the current replace!(new::Callable, A::T, count::Int). This offers several advantages:
    - For arrays, instead of copying the input and then replace elements, we can do the copy and replace
    operations at the same time, which is quite faster for arrays when count=nothing.
    - For dicts and sets, copying up-front is still faster as long as most original elements are preserved,
    but for replace(), we can apply replacements directly instead of storing a them in a temporary vector.
    - When the LHS of a pair contains a singleton type, we can subtract it from the element type
    of the result, e.g. Union{T,Missing} becomes T.
    
    Also simplify the dispatch logic by removing the internal _replace! method in favor of replace!.
    nalimilan committed Feb 26, 2018
    Configuration menu
    Copy the full SHA
    03c073c View commit details
    Browse the repository at this point in the history

Commits on Mar 23, 2018

  1. Configuration menu
    Copy the full SHA
    184c1bd View commit details
    Browse the repository at this point in the history

Commits on Mar 24, 2018

  1. More fixes

    nalimilan committed Mar 24, 2018
    Configuration menu
    Copy the full SHA
    06624ab View commit details
    Browse the repository at this point in the history

Commits on Apr 11, 2018

  1. Configuration menu
    Copy the full SHA
    1b3f5ba View commit details
    Browse the repository at this point in the history