[#28687] [Bug #2973] rb_bug - Segmentation fault - error.c:213 — rudolf gavlas <redmine@...>

Bug #2973: rb_bug - Segmentation fault - error.c:213

10 messages 2010/03/16

[#28735] [Bug #2982] Ruby tries to link with both openssl and readline — Lucas Nussbaum <redmine@...>

Bug #2982: Ruby tries to link with both openssl and readline

16 messages 2010/03/18

[#28736] [Bug #2983] Ruby (GPLv2 only) tries to link to with readline (now GPLv3) — Lucas Nussbaum <redmine@...>

Bug #2983: Ruby (GPLv2 only) tries to link to with readline (now GPLv3)

10 messages 2010/03/18

[#28907] [Bug #3000] Open SSL Segfaults — Christian Höltje <redmine@...>

Bug #3000: Open SSL Segfaults

19 messages 2010/03/23

[#28924] [Bug #3005] Ruby core dump - [BUG] rb_sys_fail() - errno == 0 — Sebastian YEPES <redmine@...>

Bug #3005: Ruby core dump - [BUG] rb_sys_fail() - errno == 0

10 messages 2010/03/24

[#28954] [Feature #3010] slow require gems in ruby 1.9.1 — Miao Jiang <redmine@...>

Feature #3010: slow require gems in ruby 1.9.1

15 messages 2010/03/24

[#29179] [Bug #3071] Convert rubygems and rdoc to use psych — Aaron Patterson <redmine@...>

Bug #3071: Convert rubygems and rdoc to use psych

10 messages 2010/03/31

[ruby-core:28426] Re: [Feature #2515] Array#select!

From: Hugh Sasse <hgs@...>
Date: 2010-03-02 19:05:03 UTC
List: ruby-core #28426
On Wed, 3 Mar 2010, Yusuke Endoh wrote:

> Hi,
> 
> 2010/3/2 Marc-Andre Lafortune <redmine@ruby-lang.org>:
> > I feel the name select! is as appropriate as map! , collect! and reject!
> 
> Some feel appropriate, and some inappropriate.
> Seems like "he said she said" scenario.
> Is there another reason than feeling and consistency (= orthogonality) ?
> 
> I'm almost neutral for the suggestion, but take a opposite point of view
> for the discussion.  If I ignore Array#reject! and consider only the name
> "select!", I can imagine the different behavior.  The name seems to me to
> return an array whose elements meet condition, and removes the *selected*
> elements from the original array, like Array#delete_at and #shift:
> 
>   ary = [1, 2, 3, 4, 5]
>   p ary.select! {|x| x.even? } #=> [2, 4]
>   p ary #=> [1, 3, 5]

I've been using Reek a lot recently.  This makes me think of the
"code smell" called "Greedy Method" in which a method is trying to
do more than one thing.  I think it would be difficult to remember
which way round the outputs are:  "Does the receiver get what the
block selected, or the return value get it?"

This would break my metaphor of methods as verbs, and ! as a verb
ending, which I've found helpful.

I can see such a function could have its uses, but even Python's
filter() doesn't work like this, even accounting for the lack of
blocks.

I'd be inclined to call such a thing ifelse, and allow it to be
applied to objects which don't iterate, as well.  It seems to be
related to unfold, because it takes one thing and returns two (i.e.
a list), 

        Hugh

In This Thread