From: Hugh Sasse Date: 2010-03-02T19:45:36+09:00 Subject: [ruby-core:28411] Re: [Feature #2515] Array#select! I got tripped up by redmine there: I thought that was going off list, but while the name of the addressee was there, the address was the redmine one, which I didn't notice. I'd argue that is a misfeature. I think the case for orthogonality is a much stronger one than POLS. select and reject are opposites, so having reject! and not select! is not orthogonal, to my mind. http://www.artima.com/intv/dry3.html Roger's argument, it seems to me, is essentially that to achieve an effect in one direction it is straightforward, but in the other you have to interact either with another method, or with assignment, a = a.select(&blocK) a.reject!(&complementary_block) This is rather like the helicopter pilot in the above (artima.com) story, and there is a case for saying it makes the code less clear. It is a circumlocution. I tend to use the assignment myself, though, because the ! signifier is a rather subtle thing, visually, for something destructive[1]. The assignment makes overwriting clearly apparent. However, that would be a case against almost all ! methods. So if destructive methods are idiomatic ruby, and if one may consider methods to be verbs, why make the language unnecessarily irregular, especially when all these reject, select, and map come from the same conceptual space of functional programming? [Of course, functional programming languages don't allow variables to change value, once bound...] Is there a significant cost to adding this, and is it more then the cost of remembering the exceptions to the rules about which destructive methods exist? I've not looked at the source, yet, for this. Hugh [1] To this same vision that failed to notice my message wasn't off list. That's why I used to use (*...*) comments in Pascal, in preference to {...}, because the printers back then made the star into a big splat. So I'm not saying Matz was wrong to choose this, I'm saying my tastes differ. On Tue, 2 Mar 2010, Yusuke Endoh wrote: > Issue #2515 has been updated by Yusuke Endoh. > > > Hi, Roger > > Hugh Sasse wrote: > > On Tue, 2 Mar 2010, Roger Pack wrote: > > > It would be more convenient and less surprising to have a select! > > > > You can use the "surprising" argument 4 or more times if you like, but > > since about 2005 Matz has said he will not accept changes > > based on the Principle Of Least Surprise, because it is his surprise > > that matters. > > > I agree with Hugh. > > In Ruby design, POLS is very unconvincing reason currently. Instead, > it may make an enemy of committer. > > # Anyone should know that many committers are bored with suggestion > # based on POLS. > > In addition, consistency rarely beats name argument, AFAIK. I propose > you find another reason. > > > I leave this ticket open for a couple of days. But I'll close again > if discussion will seem to be still stalemated. > > -- > Yusuke ENDOH > ---------------------------------------- > http://redmine.ruby-lang.org/issues/show/2515 > > ---------------------------------------- > http://redmine.ruby-lang.org >