Re: Records that could be arrays



Justin Gombos a écrit :
I have set a rule for myself: Composite types composed solely of one
type of element should be declared as arrays rather than records.
I've never seen this rule in a coding standard. The idea is that you
can be more expressive with an array. Example- there are more options
when it comes to an arrays role in control structures. Plus the
"others =>" notation is available. Thoughts?

I beg to disagree here. Arrays are for *iterative* structures, if you don't have a for loop over an array, it should be a record.

The fact that all components are of the same type may be an accident that changes during program evolution.

--
---------------------------------------------------------
J-P. Rosen (rosen@xxxxxxxxx)
Visit Adalog's web site at http://www.adalog.fr
.



Relevant Pages

  • Re: Records that could be arrays
    ... Does anyone see a reason to use a record when an array can ... type Window is array of Coordinate; ... type of element should be declared as arrays rather than records. ... when it comes to an arrays role in control structures. ...
    (comp.lang.ada)
  • Re: Records that could be arrays
    ... Justin Gombos wrote: ... of one type of element should be declared as arrays rather than ... I think it depends on the meaning of "type". ... point numbers in a polar coordinate system are of three ...
    (comp.lang.ada)
  • Re: Records that could be arrays
    ... Wilhelm Spickermann writes: ... Justin Gombos wrote: ... of one type of element should be declared as arrays rather than ... point numbers in a polar coordinate system are of three ...
    (comp.lang.ada)
  • Re: Records that could be arrays
    ... type of element should be declared as arrays rather than records. ... I've never seen this rule in a coding standard. ... don't have a for loop over an array, ... For example, Text_IO Put, Get, and AUnit checks, are more easily done ...
    (comp.lang.ada)