News for hackers. Stuff that matters.
Re:Why Operators Are Useful by aboutruby on Saturday March 16, 2019 @05:23PM (#19410373)
In Ruby, we have Hash#merge, e.g. { a: 1, b: 2 }.merge({ b: 3, c: 4 }) gives { a: 1, b: 3, c: 4 }, which is typically what you want, e.g. args.merge(reset: false) to have reset set to false in the args even if present.
Re:Why Operators Are Useful by maxerickson on Saturday March 16, 2019 @08:29PM (#19411370)
That's how dict.update works in python also. The other poster is saying that they don't like the + operator having the property of using the values from the right operand to update the left operand vs the clear semantics of the method call.