On 16 May 2002, Aaron Sherman wrote:

> On Thu, 2002-05-16 at 16:13, David Whipp wrote:
> > Aaron Sherman [mailto:[EMAIL PROTECTED]] wrote:
> > > You might not be able to REASONABLY get a length, so you return
> > > undef. In your documentation, you advise users not to take the length,
> > > but just dive right in and fetch the element you want, e.g.:
> > >
> > >     my $pi2k = @pi_digits[2000];
> > 
> > In this case, I'd expect @pi_digits.length == Inf, not undef.
> 
> If I'm wrong about no proof existing for pi's infiniteness, I apologize.
Pi has been proven irrational, and anything that can be represented with a 
finite number of decimal places is rational. So, you're wrong.

> Pick your favorite series of discrete units n, where n may or may not be
> infinite, but where series[x] can be determined (though possibly at
> great cost) for all Perl-available positive integers, x.
> 
> That aside, the point holds. Tied arrays which point to complex systems
> may not have a known length (even in Perl5). We know this.

In which case, I think undef is fine. It's up to the programmer to decide 
whether (s)he wants to use arrays that will return undef or not. 

Back to from where this arose, however, I think LAST (and BETWEEN, if it 
will exist) should probably be PRE blocks. This is the only way it could 
be consistently possible to implement. It wouldn't make any sense to have 
it a PRE block on a while and a NEXT block on a foreach.

Luke

Reply via email to