From: "trans (Thomas Sawyer)" Date: 2012-03-20T09:46:57+09:00 Subject: [ruby-core:43489] [ruby-trunk - Feature #6176] Allow Enumerable#flatten to take a block Issue #6176 has been updated by trans (Thomas Sawyer). > I think #flat_map makes more sense than #flatten accepting a block. It's unclear to me what #flatten would do with the block based on the name alone. I never felt that this is a good kind of argument per-se. For instance, at first I did not understood the use of the term #map or what it would do with a block on the name alone. The term #collect made much more sense to me, but in time I became accustomed to #map, and being shorter that's all I use now. So for #flatten, seeing that we all already use it, I'm not sure how it could be very unclear. In other words, what else could #flatten do with a block? Seems to me there are only too general choices (for any such method really), either it collects or it conditions. Do you think the block would make more sense as a condition of when to flatten and when to not? Maybe that would be better, and I would be willing to support that instead. I just don't like to see new methods invented if another method could serve the purpose, so I think it's good to be sure about it. ---------------------------------------- Feature #6176: Allow Enumerable#flatten to take a block https://bugs.ruby-lang.org/issues/6176#change-24959 Author: trans (Thomas Sawyer) Status: Open Priority: Normal Assignee: Category: Target version: I see a new method `#flat_map` has been added to Enumerable. Yet passing a block to #flatten has no use. That seems a waste, as it adds yet another method to remember when one we already know can do the job and makes sense. -- http://bugs.ruby-lang.org/