Re: RFC 212 (v1) Make length(@array) work

[email protected] (Nathan Torkington) Wed, 13 Sep 2000 12:01:49 -0600 (MDT)
Newsgroups perl.perl6.language.subs
Message-ID <[email protected]>
Casey R. Tweten writes:
> Leave length() the way it is now and, if one so desires, they may
> override it on there own to use length for getting:

Not that helpful a suggestion for beginners.  They don't know how to
override, or often even how to load a module.  The point is not that
there's already a way to do it, but that the existing way doesn't make
sense.

Scalar context makes sense in:

  if (@a) { ... }

But you have to know the innards of context to understand why you
do this to get the length of an array:

  $a = @b;

All I'm doing is suggesting another way, one that makes more sense for
beginners:

  $a = length @b;

I think we're going to have to see prototypes extended to cope with
functions like this, anyway.  I'll mention this requirement in the
next version of the RFC.

Nat