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

When called with too few arguments, an asynchronized method returns a thread before giving an invalid argument error #2

Open
iCodeSometime opened this issue May 31, 2018 · 0 comments

Comments

@iCodeSometime
Copy link
Owner

Description

When a method has been asynchronized, it will spawn and return a thread even if it has an invalid number of arguments. This is caused because the newly defined method accepts parameters through a splat operator. This is a minor issue, causing only a slight performance penalty when calling a method with the wrong number of arguments. The parameter information can be pulled, we should see if there's a way to use the actual information in the new method definition https://ruby-doc.org/core-2.2.0/Method.html#method-i-parameters.

Reproduction Steps

require 'asynchronize'
class Test
  include Asynchronize
  asynchronize :test
  def test(a, b)
    return a+b
  end
end
th = Test.new.test(1)
th.class
=> Thread
@iCodeSometime iCodeSometime changed the title An asynchronized spawns and returns a thread before giving an invalid argument error An asynchronized method spawns and returns a thread before giving an invalid argument error May 31, 2018
@iCodeSometime iCodeSometime changed the title An asynchronized method spawns and returns a thread before giving an invalid argument error When called with too few arguments, an asynchronized method returns a thread before giving an invalid argument error May 31, 2018
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