From: Albert Ng Date: 2007-03-25T00:18:14+09:00 Subject: Re: Suggestion: swap name of "puts" and "print" and rename "puts" to "put_s" ------=_Part_182054_11212685.1174749491191 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline well, the methods are already syntax consistent, where you can use put == print == printf, and puts is "put string" (I think, someone correct me). And one of the things I like most about ruby is that there are more than one way of using the same commands (e.g. the for loop sugar). 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 > > ------=_Part_182054_11212685.1174749491191--