Making 0 the first element makes as much sense as 1- just a convention.

However there is precedence for letting the user decide. Does anyone else 
remember

  )ORIGIN 1

? So we establish a var $something=n where n is the array origin.

I don't think I'd ever use it personally, having been a c "kinder", but I 
don't presume to thinkk like everyone else and others may be more strongly 
fixated on another origin.






>From: Nathan Wiger <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>CC: [EMAIL PROTECTED], Glenn Linderman <[EMAIL PROTECTED]>
>Subject: Re: RFC 76 (v1) Builtin: reduce
>Date: Sun, 27 Aug 2000 19:02:25 -0700
>
>Damian Conway wrote:
> >
> > But ^1, ^2, etc. have *nothing* to do with $1, $2, except analogically.
> > And I'm removing that analogy from the next version of the RFC! ;-)
> >
> > They have *everything* to do with $_[0], $_[1], $_[2], etc.
>
>I realize this, but I don't think most people will see it that way. I
>see the analogy part much more clearly. Having ^1 and $1 be the same
>makes a lot more sense than having $1 and ^0 both be the start.
>
>Why? Consistency is key. With arrays, people understand that [0] is the
>first element because they're dealing with a computer.
>
>But with regexps (and HOFN), we're now into stuff that's good for
>humans. And the "First" element should be "^1", just like for regexps.
>Unless you want to start telling people that the "Zeroeth" element is
>"^0".
>
>But having the "First" element be "0" makes *no* sense. Not for humans.
>It never has.
>
> > In fact, every kind of indexing in Perl -- *except* $1, $2, etc. --
> > starts at zero. Fixing $0's semantics would be far more consistent than
> > breaking ^0.
>
>That's fine too - if we want to do this, let's! Honestly. I say:
>
>    1. Make $ARGV[0] have the program name
>
>    2. Make $0 be the first regexp match
>
>But I see two problems with this:
>
>    1. Now "for (@ARGV) breaks"
>
>    2. The "first" argument is now "0" again
>
>Please! Make the "first" be ^1. It's more consistent and makes more
>sense for us humans.
>
>We're not "breaking ^0" either - it doesn't exist yet. Rather, we're
>fixing it before the bug hits the customer. I guarantee you this will be
>a common mistake, I've done tons of work in real-life user-interface
>testing. Users see *simple* analogies, not deep ones ("^1 like $1, the
>first one")
>
>If I ask you to count to ten, which number do you start with?
>
>-Nate

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.

Reply via email to