You could bypass the type checking by passing the address of the
array. You'd still have to do your own indexing. This means passing
the dimensions as well. Messy.
Perhaps a neater way is to pass a descriptor (a record containing the
address of the array, and the dimensions). I still don't see a way
around either the inefficiency of an indexing function, or the
verbosity of writing your own index computations.
Note that C (until C++) has the same problems.
Anybody have better ideas?
Ken
The function call overhead is all the additional burden required,
since the arithmetic of index computation must be done in any case.
The only other inefficiency might be when a smart optimizing compiler
can simplify some sequential accesses to the array, but isn't smart enough
(or given opportunity) to expand an indexing function call inline
in order to optimize it.
Vincent Broman, code 632, Naval Ocean Systems Center, San Diego, CA 92152, USA
Phone: +1 619 225 2365 {seismo,caip,ihnp4,ucbvax}!\\\\\\\
Arpa: bro...@bugs.nosc.mil Uucp: {floyd,moss,bang,hp-sdd,sdcsvax}!noscvax!broman
I would rather have something along the lines of Pascal's conformant arrays,
but ARRAY OF set a nasty precedent. (Several years ago I asked Niklaus Wirth
what he planned to do about making Modula-2 suitable for implementing math
libraries; he said he really didn't care about that kind of programming.)
Standard Modula-2 supports only one-dimensional open arrays, and I don't know
what the ISO group is contemplating.
- Joel McCormack {ihnp4 decvax ucbvax allegra}!decwrl!joel
jo...@decwrl.dec.com