develooper Front page | | Postings from September 2000

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

Thread Previous
Jeremy Howard
September 20, 2000 14:34
Re: RFC 206 (v2) Arrays: @#arr for getting the dimensions of an array
Message ID:
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.

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About