I think .valid is an excellent argument for underscores all by itself.
Unless you already know what it means you don't have any clue that
its not actualy the word valid instead of val_id.  I don't know of any
other problems like this, but at very least that should be changed.
Don't we still try and follow the rule of least surprise!! ?  I was
realy surprised to find out that valid was value_id, especialy since
the last reference I saw to it was along side defined, undefined, etc,
so I assumed it was related to that.

/me scratches his noggin.

I don't have any other arguments for _, but it would be interesting to
hear the reasoning agianst it.  The builtin versus userdefined is
getting realy blury in p6 anyway so it seems weird to use this as a
way to define it, after all it's not like all user functions WILL have
_ in there name.

On 8/6/06, Ashley Winters <[EMAIL PROTECTED]> wrote:
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



--
--
__________
Eric Hodges

Reply via email to