Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ashishmax31/immutable-ruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: immutable-ruby/immutable-ruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 13 commits
  • 13 files changed
  • 2 contributors

Commits on Nov 28, 2021

  1. Fix tests for Immutable.to_ruby for Ruby 3.0

    In Ruby 2, SortedSet was part of the standard library. In Ruby 3, it
    was removed from stdlib and put into a gem. This new gem implements
    SortedSet using RBTree (from the 'rbtree' gem). As a result, the
    behavior of `SortedSet#eql?` has changed; two SortedSets only compare
    as equal using `#eql?` if they are the same object, not if their
    contents are the same.
    
    This behavior does not match built-in Ruby data structures like `Hash`
    and is arguably incorrect. It was reported as an issue in the GitHub
    repository for `sorted_set` almost a year ago, but has not been fixed.
    
    We would love to see this issue with the new `sorted_set` gem fixed,
    but in the meantime, we can simply avoid using `SortedSet#eql?` for
    testing equality in our specs.
    alexdowad committed Nov 28, 2021
    Configuration menu
    Copy the full SHA
    a8acf28 View commit details
    Browse the repository at this point in the history
  2. Check arity of comparator block for SortedSet correctly for Ruby 3.0

    The behavior of `&:method` blocks has changed in Ruby 3.0. Previously
    they had arity -1; now it's -2. I don't know the reason for this
    change.
    
    While we fix that, we can also be more strict in rejecting blocks with
    an arity which we can't use. These would result in an exception
    anyways, but it will be better to raise an exception with a more
    understandable error message.
    alexdowad committed Nov 28, 2021
    Configuration menu
    Copy the full SHA
    4fddf90 View commit details
    Browse the repository at this point in the history
  3. Fix SortedSet#eql? for Ruby 3.0

    It seems that the behavior of `Kernel#loop` might have changed a bit
    in Ruby 3.0. Adjust `SortedSet#eql?` accordingly.
    alexdowad committed Nov 28, 2021
    Configuration menu
    Copy the full SHA
    952d11a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ead7d2a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5c13a63 View commit details
    Browse the repository at this point in the history
  6. Use sorted_set gem to implement Immutable.{from,to_ruby} on Ruby 3.0

    Ruby's SortedSet used to be included in set.rb (standard library).
    Starting from Ruby 3.0, it's not. Rather, it has been broken out into a
    gem.
    
    So to keep the one part of `Immutable` which references SortedSet
    working, we need to pull in that gem. I don't like this, but it's
    better than potentially breaking user code.
    alexdowad committed Nov 28, 2021
    Configuration menu
    Copy the full SHA
    fe64cb2 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    18555a2 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    84dba73 View commit details
    Browse the repository at this point in the history
  9. Remove unneeded code from SortedSet#eql?

    In the commit message for 952d11a, I wrongly suggested that the code
    for this method needed to be adjusted for Ruby 3.0. It seems that
    rather, I had broken it when refactoring uses of `while true` loops to
    use the `loop` method instead.
    
    With that change, the final `rescue` clause became dead code.
    alexdowad committed Nov 28, 2021
    Configuration menu
    Copy the full SHA
    f5d060c View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2022

  1. Fix broken link

    cllns authored and alexdowad committed Feb 9, 2022
    Configuration menu
    Copy the full SHA
    e97c749 View commit details
    Browse the repository at this point in the history

Commits on Apr 20, 2024

  1. Break circular dependency loops caused by Hash/Vector/Set all requiri…

    …ng each other
    
    Thanks to Sean Collins for reporting that he was getting the following
    warning when using Immutable::Hash:
    
        immutable-ruby/lib/immutable/vector.rb:2: warning: immutable-ruby/lib/immutable/vector.rb:2: warning: loading in progress, circular require considered harmful - immutable-ruby/lib/immutable/hash.rb
    
    To break the loop, move the definitions of Immutable::Hash,
    Immutable::Vector, and Immutable::Set (all of which depend on each
    other) into a new file, which is required from hash.rb, vector.rb, and
    set.rb, but which doesn't require any of those files itself.
    alexdowad committed Apr 20, 2024
    Configuration menu
    Copy the full SHA
    d8874cf View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    59fb969 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7d20d25 View commit details
    Browse the repository at this point in the history
Loading