[#82311] [Ruby trunk Bug#13794] Infinite loop of sched_yield — charlie@...
Issue #13794 has been reported by catphish (Charlie Smurthwaite).
4 messages
2017/08/09
[#82518] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — mame@...
Issue #13618 has been updated by mame (Yusuke Endoh).
5 messages
2017/08/30
[#82552] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2017/08/31
mame@ruby-lang.org wrote:
[#82756] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wrong <normalperson@...>
2017/09/12
Eric Wrong <normalperson@yhbt.net> wrote:
[ruby-core:82362] Re: [Ruby trunk Bug#13795] Hash#select return type does not match Hash#find_all
From:
Martin J. Dürst <duerst@...>
Date:
2017-08-12 10:48:23 UTC
List:
ruby-core #82362
On 2017/08/11 01:12, david.n.arnold@gmail.com wrote:
> Also, as a side note, it seems that Hash#select and #reject really are the only two methods that behave this way. And even inside Hash, methods like #collect, #collect_concat, #drop, #drop_while, #grep, #max, #max_by, #min, #min_by, #sort, #sort_by, #take, and #take_while are all still returning Array.
Let's analyze this a bit.
#max, #max_by, #min, #min_by
These return a single key, value pair as an array. That's much easier to
handle than a hash with a single key, value pair, and is also quite a
bit more efficient internally (although we shouldn't care). That feels
right to me.
#grep
In the case of a hash, the argument to #grep has to be a two-element
array ([key, value]). Because there is only one entry with a given key
in the hash, the result will also be a single two-element array,
#collect, #collect_concat
The block for collect can return anything. Putting these 'anythings'
together again can only be done with an array, not with a hash. As an
example, think about something like:
h.collect {|k, v| "#{k}-#{v}"}
We get back strings, and there is no such thing as a Hash of Strings.
#sort, #sort_by
Although Hashes now have order, that wasn't always the case. And Hashes
are still not considered the prime class when dealing with order. As an
example, they don't allow easy access to an element at a certain
position in the order.
#drop, #drop_while, #take, #take_while
Similar considerations to those for #sort apply here, although maybe not
that strongly.
> ----------------------------------------
> Bug #13795: Hash#select return type does not match Hash#find_all
> https://bugs.ruby-lang.org/issues/13795#change-66129
>
> * Author: davidarnold (David Arnold)
> * Status: Open
> * Priority: Normal
> * Assignee:
> * Target version:
> * ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
> * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
> ----------------------------------------
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>