Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!haven!adm!cmcl2!stealth.acf.nyu.edu!brnstnd From: brnstnd@stealth.acf.nyu.edu Newsgroups: comp.lang.misc Subject: Re: Pointers as 3-tuples Message-ID: <2261:Apr1120:08:1090@stealth.acf.nyu.edu> Date: 11 Apr 90 20:08:10 GMT References: <296:Apr1105:06:4490@stealth.acf.nyu.edu> <14333@lambda.UUCP> Reply-To: brnstnd@stealth.acf.nyu.edu (Dan Bernstein) Distribution: usa Organization: IR Lines: 58 In article <14333@lambda.UUCP> jlg@lambda.UUCP (Jim Giles) writes: > From article <296:Apr1105:06:4490@stealth.acf.nyu.edu>, by brnstnd@stealth.acf.nyu.edu: > > In article <14327@lambda.UUCP> jlg@lambda.UUCP (Jim Giles) writes: [ the following overgeneralization: ] > >> Multidimensional arrays > >> are NOT arrays-of-arrays. The subscripts of a multidimensional > >> array are independent and carry _equal_ weight. > > Both assembly code and mathematics say otherwise: at some level of > > specification (the opposite of abstraction), a multidimensional array > > really is an array of arrays. I agree, the user often doesn't think of > > it that way; but it's still the truth. > Who cares about what assembly code does? It is the purpose of a high > level language is to present an environment that is relatively free > from such concerns. Relatively but not completely. Any program will show a speed hit if you bounce all around memory rather than going through it sequentially; as the user can notice this and (in C but not in Fortran!) write code to prevent it, your overgeneralization is inaccurate. > Mathematically, what you say is not true. The ordering of subscripts > is an arbitrary decision by the mathematician who lays out the calculation. Not at a certain level. The ordered pair (a,b) is usually defined as the set {a,{a,b}}, which is not symmetric---though of course you knew that. Then again, the isomorphism between ((a,b),M(a,b)) and (a,(b,M(a,b))) makes it obvious that a matrix M of n dimensions is a one-dimensional array consisting of matrices M_i of n - 1 dimensions. In other words, a multidimensional array is an array of arrays. Yeah, that's it, lay on the heavy terminology and he'll crumple. :-) > The only > time such concerns become important [ but your overgeneralization implies they're nonexistent! ] > is when efficiency forces them > into the limelight. Golly, I never worry about uh-fish-in-sea. Duh, Pee-tuh, do you ever worry about uh-fish-in-sea? 1/2 :-) > >> > INTEGER A(10) > >> > CALL PROC(A,A) > >> Not necessarily broken. Only if PROC modifies one or more of its > >> arguments. > > Note that Fortran has no way to express that concept explicitly, while C > > can declare const int *A. Hmmm, shall we start flogging this horse too? > Why not? I _support_ the addition of an explicit way of declaring which > procedure arguments are changed and which are not. Aha! I _support_ the addition of an explicit way of using parameters as array dimensions (and in fact even more generally---but that's a start). Let's make a pact: You shut up about C's failure to provide parametrized dimensions and I'll shut up about Fortran's failure to detect errors in changing what are meant to be constant values. Agreed, at least for this discussion? ---Dan