On Nov 12, 2007 1:10 PM, <furtive.clown / gmail.com> wrote: > > This is the first I've heard of Object#tap. It seems backward because > you almost always want the result of the block, not the object back > again. All of my ruby scripts use > > class Object > def as > yield self > end > end This can be useful in the right context. Should it be canonized in Ruby? I'm not sure. > platform_audio_files = audio_stems.map { |f| > f + "." + audio_ext[platform] > }.as { |t| > t + audio_basenames > }.map { |f| > File.join(audio_dir, f) > } This method chaining looks ugly to me, but I'm not a CS guy; so, to each his own. > I know this could be written > > platform_audio_files = (audio_stems.map { |f| > f + "." + audio_ext[platform] > } + audio_basenames).map { |f| > File.join(audio_dir, f) > } > > but I find that uncouth compared to the former. > > If ruby is adding anything, it should be the behavior of Object#as, > not Object#tap. You are suggesting that people add something that probably doesn't need to be added. I'm halfway convinced, but I think you should present a couple more use cases for me to sway your way (sorry, folks, for the poetic language :-) Todd