You have not changed my understanding of anything. One of us hasn't made their point clearly enough, and I'm guessing it's me.
Most of the time, I generate the text I output. I don't want it to be modified by my output function. When using puts, the only way to guarantee the text I generated will be output with a newline added is to add one myself.
say($var); # Newline added. That's why I use "say".
puts($var); # Newline maybe added. Useless for text I generated.
puts("$var\n"); # Newline added, but purpose defied.
Yes, they are uses for puts, but there are for say too. Don't change say, add puts.
But that's not to say ruby's puts makes sense either. Since the goal of puts is to prevent third parties from messing the output, it makes no sense for puts to chomp just one newline. It should remove all but one, adding one if necessary.
|