Newsgroups: comp.lang.perl Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!news From: rlk@think.com (Robert Krawitz) Subject: Re: Ruminations on the future of Perl In-Reply-To: tchrist@convex.COM (Tom Christiansen) Message-ID: <1991Jun30.021958.13916@Think.COM> Sender: news@Think.COM Reply-To: rlk@think.com (Robert Krawitz) Organization: Thinking Machines Corp., Cambridge MA References: <1991Jun28.020603.1069@zardoz.club.cc.cmu.edu> <1991Jun28.212606.19054@convex.com> Date: Sun, 30 Jun 91 02:19:58 GMT Lines: 33 A couple of other things I would like in perl: 1) True multidimensional arrays. Associative arrays simply don't cut it, if nothing else for the fact that looping over associative arrays yields values in an unpredictable order, whereas I want something that looks a bit more like a matrix. Some ideas: rank(@a) returns the rank of a (the number of dimensions). This enables support for true arbitrarily (and variably) dimensioned arrays. $a[@dims] uses the list as a group of dimensions. Thus a list of dimensions could be used to access an array that may be of variable dimensionality (such as might be passed to a subroutine). Scalar and vector dimensions could be mixed, e. g. $a[$dim0,@dim1_n]. maxindex(@a,$dim) returns the maximum index along dimension $dim (since the array might not be square, it would return the largest index along any vector aligned with dimension $dim). Similar for minindex. foreach $i (@array) sets a variable @_DIMS to a list of the indices of the current element of @array. isin (@array @indices) returns true or false (1 or 0) depending on whether @indices represent an element of @array. 2) A mode to catch references to an undefined variable and error out at runtime, along with some kind of optional typing system to catch stupid errors (for example, using a string as a number). Also a method to "declare" typed arguments to subroutines with runtime type checking. -- ames >>>>>>>>> | Robert Krawitz 245 First St. bloom-beacon > |think!rlk (postmaster) Cambridge, MA 02142 harvard >>>>>> . Thinking Machines Corp. (617)234-2116