Why? puts and p do the same thing, it feels redundant. The only reason I can think of, is it’s consistent with puts(Tuple) and puts(Hash), but it’s unexpected (after Ruby) and useless (duplicate of p).
I’ve come from Pascal and C (but also have some experience with Ruby) and i think puts(Array) behaving differently from puts(Tuple) would be very confusing, to a point of never using puts on something except String (so I would always do puts(x.to_s)).
I would be unhappy with the change because it seems unnecessary and behaves differently from any other language I’ve worked with (since I have very little Ruby experience). I agree with others here that Array should behave similarly to Tuple and other Enumerable types when used with puts.
I also don’t think that it’s a bad thing that it takes more code to print array elements on multiple lines. While the array.each method you showed above is more code than just puts, it’s much more clear what’s intended. One of Crystal’s greatest strengths is that it’s naturally pretty easy to read, and I think that encouraging self-documenting code like that is more important than giving shorter ways to do everything.
To be honest, when I know I’m dealing with an array, I use puts array in Ruby if I want to print elements line by line. In Crystal I need to do puts array.join("\n") which is a bit longer.
The thing is, it took me a while to understand why Ruby was doing this strange thing with puts with Array. And from time to time it annoys me that I want to print an array like what you normally get when you puts a Hash or basically anything, and Ruby prints it line by line. Then I have to change it to p.
In Crystal you have to type a bit more for the “print each item in a line”, but I prefer consistency over special cases.