ruby-concurrency / ruby-concurrency/concurrent-ruby
Add keyword arguments to async
Offen
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Ruby
- Sterne
- 5.8k
- Forks
- 420
- Ø Merge
- 20 Std. 45 Min.
- Gemergte PRs (30 T.)
- 4
Beschreibung
Feature request
Add support for keyword arguments when using async
From the docs
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Start with the Concurrent::Async entry point and the linked Async documentation, then reproduce the keyword-argument example on Ruby with concurrent-ruby 1.2.3. Trace the async call through the proxy and compare it with the direct call. Done means async and await calls accept the named argument and return the expected result without the reported ArgumentError.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- ruby
- Bereich
- backend
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100