You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Echo
include [Concurrent](https://ruby-concurrency.github.io/concurrent-ruby/1.2.3/Concurrent.html)::Async
def echo(msg)
print "#{msg}\n"
end
end
horn = Echo.new
horn.echo('zero') # synchronous, not thread-safe
# returns the actual return value of the method
horn.async.echo('one') # asynchronous, non-blocking, thread-safe
# returns an IVar in the :pending state
horn.await.echo('two') # synchronous, blocking, thread-safe
but if i modify it to use named arguments like so it doesn't work
class Echo
include [Concurrent](https://ruby-concurrency.github.io/concurrent-ruby/1.2.3/Concurrent.html)::Async
def echo(msg: )
print "#{msg}\n"
end
end
horn = Echo.new
horn.echo(msg: zero') # synchronous, not thread-safe
# returns the actual return value of the method
horn.async.echo(msg: 'one') # asynchronous, non-blocking, thread-safe
# returns an IVar in the :pending state
horn.await.echo(msg: 'two') # synchronous, blocking, thread-safe
#when I try to get the value
horn.await.echo(msg: 'two').value #nil
horn.await.echo(msg: 'two').reason #<ArgumentError: wrong number of arguments (given 1, expected 0)>
I appreciate any future feedback from the maintainers on this 🙏
System information
* Operating system: mac
* Ruby implementation: Ruby
* `concurrent-ruby` version: 1,2,3
* `concurrent-ruby-ext` installed: no
* `concurrent-ruby-edge` used: no
Activity
turnon commentedon Feb 23, 2024
There is nothing wrong to get
nilfromvalue. Becauseprintjust write to STDOUT and returnnilAnd I can not reproduce
ArgumentErrorfromreason. Would you try that again ?romiras commentedon Oct 15, 2024
I have same error in Ruby 3.0.3, concurrent-ruby 1.3.4.
and
_a Echo1.instanceoutput is:(works fine)
_b0 Echo2.instanceoutput is:(works fine)
and
_b1 Echo2.instanceoutput is:where
@reasonhas error.eregon commentedon Oct 15, 2024
Could you start a PR to fix and add specs for this?
It's probably just using
*argssomewhere withoutruby2_keywords.reeganviljoen commentedon Oct 15, 2024
@eregon I should have some time near the end of the weak if no else picks this up
romiras commentedon Nov 14, 2024
ok, I hope it's not a big deal.