Tim Hunter
4/7/2006 11:31:00 PM
Daniel Schierbeck wrote:
> shadytrees@gmail.com wrote:
>
>> It puzzles me since other methods such as "Array.fill" or
>> "String.slice" all use the imperative mood, the one without an "s"
>> attached to a verb, but "Kernel.puts" uses third-person singluar, the
>> one with an "s." Is there a reason behind the different naming?
>
> `puts' and `gets' are not words used solely by Ruby. In fact, I think
> practically all programming languages use them.
>
> I've always thought they were abbreviations of `put string' and `get
> string', respectively.
>
>
> Daniel
I'm reasonably certain the method is named after the "puts" ("put
string") function in the standard C library. There are many methods in
Ruby that are named the same as their corresponding C or Unix function:
system, raise, fork, printf and sprintf, putc, exit, etc.