From: Jeremy Kemper Date: 2008-06-10T14:57:32+09:00 Subject: [ruby-core:17173] Re: Enumerable::Enumerator#with_memo On Mon, Jun 9, 2008 at 12:11 PM, David Flanagan wrote: > Akinori MUSHA wrote: >> >> Hi, >> >> Earlier today I added a new instance method named `with_memo' to >> Enumerable::Enumerator, but I'm not 100% sure if the name fits the >> function. > > I'd like to try to revive this thread, if I can. This seems to me an > important new method in a core part of the Ruby platform and I'm quite > surprised that we haven't heard more debate from the usually more vocal > ruby-core community. > > I don't like the name with_memo. Rick DeNatale proposed "returning" > instead, and I like that better than with_memo. I've also proposed a > separate, related method named "adding" that does not return its argument. > (But that proposal isn't fully thought out, since I haven't convinced > myself what a more useful return value would be.) > > Anyway, I suspect that the silence in this case means that the thread has > been overlooked and not that no one really cares about the name of this > method. This method has just been added into 1.9. I'd suggest that > whatever name it has when 1.9.0-2 is released in a couple of weeks ought to > be the final name. So we don't have much time to debate this and try to get > it right. I think with_memo is adequate. It's clear that it yields the argument as a memo object, but not so clear that it returns the memo object. I prefer returning. It's clear that the argument is yielded and returned. Maybe enum.also_yielding(object) { |(*args), memo| ... }. In any case, the verb in the method name describing behavior (yielding, returning, inject, map, etc) is much better than a noun describing what's yielded (memo) but not behavior. Best, jeremy