supposedMap = nil
if supposedMap == nil
puts "Operator == works fine - 1"
end
supposedMap = map foo: 1
if supposedMap == nil
puts "Operator == works fine - 2"
end
gives the following output:
{run: 2683, time: 0.0}
ββ "Operator == works fine - 1"
and the following crash error:
untime Error: [buffer 3, line 6] - NoMethodError
Thread death!
undefined method `map' for nil:NilClass
other.map == @map
^^^^
C:/Program Files/Sonic Pi/app/server/ruby/core.rb:411:in `=='
workspace_three:6:in `block (2 levels) in __spider_eval'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:905:in `eval'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:905:in `block (2 levels) in __spider_eval'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:1169:in `block (2 levels) in __in_thread'
I can understand that testing for equality between a map and another map can be tricky. But at least, it should be possible to test a map equality against something else than a map, e.g. nil.