[#88925] [Ruby trunk Feature#15095] [PATCH] share VM stack between threads and fibers if identical — ko1@...
Issue #15095 has been updated by ko1 (Koichi Sasada).
4 messages
2018/09/09
[#88927] Re: [Ruby trunk Feature#15095] [PATCH] share VM stack between threads and fibers if identical
— Eric Wong <normalperson@...>
2018/09/09
[email protected] wrote:
[#88926] [Ruby trunk Feature#15095] [PATCH] share VM stack between threads and fibers if identical — ko1@...
Issue #15095 has been updated by ko1 (Koichi Sasada).
3 messages
2018/09/09
[#89218] [Ruby trunk Bug#15130] open-uri hangs on cygwin — duerst@...
SXNzdWUgIzE1MTMwIGhhcyBiZWVuIHVwZGF0ZWQgYnkgZHVlcnN0IChNYXJ0aW4gRMO8cnN0KS4K
5 messages
2018/09/30
[ruby-core:89125] [Ruby trunk Feature#15145] chained mappings proposal
From:
merch-redmine@...
Date:
2018-09-22 00:06:20 UTC
List:
ruby-core #89125
Issue #15145 has been updated by jeremyevans0 (Jeremy Evans).
Tracker changed from Bug to Feature
Backport deleted (2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN)
koenhandekyn (koen handekyn) wrote:
> proposal allow
>
> ~~~ ruby
> collection.map(&:instrument, &:issuer, &:name)
> ~~~
>
> implementation is trivial
Is it possible for you to share your trivial implementation of passing more than one block to a method? :)
It is true that the implementation of something like:
~~~ ruby
collection.chained_map(:instrument.to_proc, :issuer.to_proc, :name.to_proc)
~~~
is fairly trivial, but it could easily be added via an external gem. I don't think it makes sense to add a `Enumerable#chained_map` core method or to modify the `Enumerable#map` core method to accept arguments. And I think adding the ability for a method to accept multiple blocks would be another feature request entirely.
In my opinion, it would probably be clearer to just use `map` with a single block:
~~~ ruby
collection.map { |e| e&.instrument&.issuer&.name }
~~~
----------------------------------------
Feature #15145: chained mappings proposal
https://bugs.ruby-lang.org/issues/15145#change-74144
* Author: koenhandekyn (koen handekyn)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
propsal, have map accept array of method references to make chained mapping simpler with suggestion to implement it to behave like the &. operator so that intermediate nil values just ripple through as nil values
proposal allow
~~~ ruby
collection.map(&:instrument, &:issuer, &:name)
~~~
implementation is trivial
this as a conceptual alternative to (with important remark is that if first or second mapping returns nil values the above code will break, forcing a much more verbose notation)
~~~ ruby
collection.map(&:instrument).map(&:issuer).map(&:name)
~~~
proposal to be functional equivalent to
~~~ ruby
collection.map { |e| e&.instrument }.map { |e| e&.issuer }.map { |e| e&.name }
~~~
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>