Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function zip of enumerable module fails if debugger is enabled #36

Open
agilmartin opened this issue Jun 2, 2022 · 0 comments
Open

Comments

@agilmartin
Copy link

agilmartin commented Jun 2, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant