On 8/6/06, Yuval Kogman <[EMAIL PROTECTED]> wrote:
Hi,Audrey mentioned that Perl 6 is trying to avoid underscores in the core library. It came up when I asked why "valid" isn't called "value_id" because if ( $user_input.valid ) { } reads fairly confusingly. So, a few questions: 1. what is the "official" naming style for the Pelr 6 standard library (not just functions, but methods for core objects, the MOP, the compiler toolchain, the truely absolutely core modules, etc). 2. What is bad about underscores? From what I know most people tend to think that $object.do_that_action is the clearest way of naming methods, and the technical reasons to avoid these (long symbol names, lots of typing) are no longer really valid nowadays (with editor autocompletion, etc).
Nothing is wrong with underscores. In fact, under_scores and camelCase/StudlyCaps should be encouraged I<in user code>. When you see function_name() or functionName() or _functionname(), it should be obvious to any Perl programmer that it's *not* a standard Perl function -- it's a user/module function. When you see SCARYCAPS, you should expect out-of-band implicit (action-at-a-distance) behaviour from whatever code it in it. Think of underscores and caps as a form of twigil. $scalar, @array, %hash, &sub, &_internal, &userFunction, &user_function, &RefugeeWindowsProgrammer, &Let_There_Be_Poetry, &MAGIC, &UNAUTHORIZED_USER_MAGIC. And, just like $scalars can hold arrays, &somesub could be a standard function or a user function (or a standard function which a user reimplemented -- you never know). - Ashley Winters
