sketchup-ruby-debugger icon indicating copy to clipboard operation
sketchup-ruby-debugger copied to clipboard

Function zip of enumerable module fails if debugger is enabled

Open agilmartin opened this issue 2 years ago • 0 comments

The following code fails if debugging is enabled

class Vector
  include Enumerable
  
  def initialize(coordinates)
    @coordinates = coordinates
  end
  
  def each(&block)
    @coordinates.each(&block)
  end
  
  def +(other)
    Vector.new(zip(other).collect { |x, y| x + y })
  end
end

v1 = Vector.new([1.0, 2.0])
v2 = Vector.new([2.0, 3.0])
v1 + v2

The message is TypeError: no implicit conversion of nil into String.

The code runs just fine if the debugging is not enabled.

An equivalent implementation without zip doesn't have this problem.

BTW: I know there is Vector class in standard ruby library and Vector3d in Sketchup API. This is just an example, how debugger fails.

agilmartin avatar Jun 02 '22 12:06 agilmartin