From: "David A. Black" Date: 2005-10-09T21:19:40+09:00 Subject: Re: bang methods Hi -- On Sun, 9 Oct 2005, Gavin Sinclair wrote: > > Hal Fulton wrote: >> >> It's not a matter of the English language as such -- English is just >> the language that the keywords and method names are based on. >> >> I oppose select! not on the basis on English purity, but on that of >> Ruby purity. > > Can you justify that opposition in the context of the following Array > methods? > > collect! compact! flatten! map! reject! reverse! > slice! sort! uniq! I'm not sure what you mean by the context of those methods. It's just a question of whether select! is a good name for the proposed behavior. > I've read the whole thread (perhaps too quickly), and don't see what at > all is controversial about #select! as an in-place #select. Read it less quickly :-) My problem with it is that "a dangerous version of select" doesn't evoke this behavior to me, and "an in-place version of select" I find meaningless. I consider "select" fundamentally a benign operation, not an operation that can either have or not have dangers associated with it. See thread for more. [...] > Finally, FWIW, here's a list of Array methods that _don't_ have an > in-place counterpart (including Enumerable methods): > > find_all grep sort_by > > Gee, not many! (Especially as #find_all is just #select.) As a lover > of minutae, I'd like to hear people's arguments for and against banging > these :) (ooh errrr) find_all! and grep! don't seem to mean anything, other than "Tell me which elements pass this test -- *really* tell me!" sort_by! would be useful (or, as we've joked on irc, sort!_by :-) David -- David A. Black dblack@wobblini.net