News for hackers. Stuff that matters.
Re:Sick of Ruby, dynamic typing, side effects, and object-or... by orf on Tuesday November 07, 2017 @05:24AM (#15642219)
I'm all for bashing the insane world of Javascript, and think that the argument grandparent is is making is quite weak, but not many languages have deep-equality baked in.

Sure, you can perhaps override some methods on an object, but given two arbitrary objects (like two dicts in Python), knowing if two are 'equal' is not easy and certainly not built in.

That being said, JS doesn't make implementing this easy or simple at all.

Re:Sick of Ruby, dynamic typing, side effects, and object-or... by robhu on Tuesday November 07, 2017 @09:12AM (#15643453)
This works in Ruby:

  irb(main):001:0> require 'set'
  => true

  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
Re:Sick of Ruby, dynamic typing, side effects, and object-or... by sametmax on Tuesday November 07, 2017 @07:42AM (#15642865)
Actually it works in Python. And it's VERY handy, especially in unit tests.

See my other comment.