Skip to content

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

@iCodeSometime

Description

@iCodeSometime

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions