Style question: when to use underscores

Citát "francisrammeloo@hotmail.com" <francisrammeloo@hotmail.com>:

But the Ruby built in classes
do not always use them.
For example: IO#readlines
Why not: IO#read_lines ?

I find that to be very rare in the standard libs, and almost exclusively when
the library in question is a relatively thin C binding. In that specific case,
I prefer to iterate over the lines of a file to avoid loading the whole thing
into memory. It's a habit you get into the first time you do a script working
with 200MB log files :wink:

For the love of god, resist the urge to use PascalCase or CamelCase for method
names, or more insane conventions like the one with defining and calling
methods reflexively (abandon all hope of an eventual Rite optimizing that).
Almost the whole core API and all of the standard lib I've used so far uses
underscores everywhere, both of the style guides recommend doing that, and
that's reason enough to do so. A convention should always take preference over
personal taste.

Side note: minor snags go to the Python standard lib for using every possible
convention, not so minor fluffs go to the wxRuby people for ruby-izing the
method names, although I'd welcome the get_foo and set_foo methods to be made
into proper accessors while it's still morally acceptable to cause that much
breakage.

David

It was a joke, not a serious advice. Come on, laugh, it's funny. Hahaha...

···

On 2005-08-03 22:52:33 +0900, david@vallner.net wrote:

For the love of god, resist the urge to use PascalCase or CamelCase for method
names, or more insane conventions like the one with defining and calling
methods reflexively (abandon all hope of an eventual Rite optimizing that).

--
Florian Frank