develooper Front page | perl.perl6.language.data | Postings from September 2000

Re: RFC 206 (v2) Arrays: @#arr for getting the dimensions of an array

From:
Jeremy Howard
Date:
September 20, 2000 14:34
Subject:
Re: RFC 206 (v2) Arrays: @#arr for getting the dimensions of an array
Message ID:
004d01c0234b$25eb9790$c1252ccb@SAMANTHA
Bart Lateur wrote:
> On 20 Sep 2000 04:07:27 -0000, Perl6 RFC Librarian wrote:
>
> >Where an array is declared without ':bounds', @# returns the largest
> >bounds of each dimension that has been accessed:
>
> Wouldn't that be slow?
>
It depends. The array creation RFC proposes that LOLs declared with a simple
type be stored as compact arrays. In this case their bounds would have be to
stored internally (otherwise the indexes of the data structure can not be
derived). The only difference between this and using :bounds is that :bounds
turns off autovivification and turns on bounds checking exceptions.

If it is a good-old-fashioned Perl 5 list of lists, then yes, finding the
bounds would be slow (by some definition of slow). But it would be faster
than a pure Perl approach... I don't imagine @# being much used outside of
typed arrays, however.





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About