Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why "Kernel.puts" and not "Kernel.put"?

3 views
Skip to first unread message

shady...@gmail.com

unread,
Apr 7, 2006, 6:56:48 PM4/7/06
to
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?

Daniel Schierbeck

unread,
Apr 7, 2006, 7:07:50 PM4/7/06
to
`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

Tim Hunter

unread,
Apr 7, 2006, 7:31:06 PM4/7/06
to

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.

paul.de...@gmail.com

unread,
Apr 7, 2006, 9:25:55 PM4/7/06
to
"puts" stands for "put string". For a detailed explanation, please go
to http://pine.fm/LearnToProgram/?Chapter=04

Paul Denlinger

shady...@gmail.com

unread,
Apr 8, 2006, 9:42:18 AM4/8/06
to
Awesome. Thanks.

0 new messages