Re:Sick of Ruby, dynamic typing, side effects, and object-or...
by Sacho on Tuesday November 07, 2017 @08:21AM
(#15643095)
You're right, I forgot about those and overstated my case.
Re:Sick of Ruby, dynamic typing, side effects, and object-or...
by always_good on Tuesday November 07, 2017 @09:56AM
(#15643818)
I don't blame you. I think the only reason I ever do deep comparison is in unit tests, and every test/assertion library has a `deepEquals` assertion, so it's not something I regularly miss.
There are better examples of deficiencies in Javascript's standard library, especially when targeting browsers, but Javascript has made massive strides lately like its native Set and Map datastructures.
For example, Set doesn't come with the classic methods `.intersection()` / `.difference()` / `.union()` / etc. but it's just not a defining moment of my overall experience with Javascript.
We're long past the days where you had to bring your own `Array#map`, but I don't know if all of these commenters are.
Re:Sick of Ruby, dynamic typing, side effects, and object-or...
by robhu on Tuesday November 07, 2017 @09:09AM
(#15643438)
Ruby too:
irb(main):002:0> {'foo' => [1, 2, [true].to_set]} == {'foo'
=> [1, 2, [false].to_set]}
=> false
irb(main):003:0> {'foo' => [1, 2, [true].to_set]} == {'foo'
=> ['1'.to_i, 2, [true].to_set]}
=> true
>>> {"foo": [1, 2, set([True])]} == {"foo": [1, 2, set([False])]}
False
>>> {"foo": [1, 2, set([True])]} == {"foo": [int('1'), 2, set([bool(1)])]}
True