From: Jeremy McAnally Date: 2007-03-25T00:12:41+09:00 Subject: Re: Suggestion: swap name of "puts" and "print" and rename "puts" to "put_s" The puts and putc methods are named after their C-equivalents, so I see no real benefit in this change. Someone coming from C or C++ would be more comfortable with the current naming, whereas someone like yourself (.e.g, coming from BASIC or Python or what have you) would be more comfortable with your proposed naming. I think maybe just keeping it the way it is will satisfy about the same amount of people and keep all existing code in working order. You have to learn a lot of new stuff when you learn Ruby, why not a new output function? ;) --Jeremy On 3/24/07, Michael Brooks wrote: > Hello: > > I've been using Ruby on-and-off for about 4 weeks now and love it. > However, some of the naming consistencies really bug me. The ones that > bug me the most are the "print", "puts" and "putc". > > I'd like to suggest that the functionality of the names "puts" and > "print" should be swapped so that "print" automatically sends a newline > character and "puts" doesn't. The reasons for this are as follows: > > - "print" in other languages I've used (e.g. Basic) sends out a newline > character. > > - "putc" doesn't send out a newline so why should "puts". > > - The "puts" method sounds like a techier name so it shouldn't be doing > console style formatting and "print" sounds like the name you'd expect > to be using with terminal / printer based formatted output. > > Also, I'd like to suggest that the "putc", "puts", "gets" and "getc", > etc... should be renamed to "put_c", "put_s", "get_s" and "get_c", > etc... to keep their syntax consistent with the naming conventions used > with "to_s", "to_a" and "to_i". Or alternately, rename "to_s", etc... > to "tos", etc... Either way, just make it consistent. > > At a minimum I think the "put_c", "put_s", etc... should be implemented > and the "putc", "puts", etc... identified as obsolete syntax. > > I realize these changes would effect every piece of Ruby code but the > language is still fairly young (at least with respect to it's version > number) and since it sounds like version 2.0 is going to break a few > things it might be a good time to adjust a few names and conventions. > I'm sure a little Ruby script using regular expressions could rename > everything quite easily. Alternately, new versions of Ruby could have a > command line switch to run the old syntax but by default would run the > new syntax. > > I apologize in advance for irritating anyone... I'm still new to Ruby > and maybe I misunderstood some of the intentions behind the naming > conventions. It's because Ruby is so consistent/smart in many other > areas (I love the OO goodness) that this stuff (don't get me started on > Find.find() or Benchmark.bm()) bugs me. I love promoting Ruby with > co-workers but can't help but mention (or get asked) why some things > like this look kind of silly. > > Just a thought, have a good day everyone! > > Michael > > -- http://www.jeremymcanally.com/ My free Ruby e-book: http://www.humblelittlerubybook.com/book/ My blogs: http://www.mrneighborly.com/ http://www.rubyinpractice.com/