|
From: Larry Kilgallen on 5 Sep 2005 18:50 In article <wcck6hvnpsm.fsf(a)shell01.TheWorld.com>, Robert A Duff <bobduff(a)shell01.TheWorld.com> writes: > "Jeffrey R. Carter" <spam(a)spam.com> writes: > >> Gene wrote: >> >> > -- 'First is not always 1. How marginally >> > Ada! >> >> 'First is not always 1 (or 0, or X) is a basic concept in Ada. It's only >> if you don't know, or forget, this, and assume the behavior you learned >> in lesser languages, that you have problems. >> >> I came to Ada from Pascal, so I was used to the lower bound not being >> fixed, > > Heh? The lower (and upper!) bound of all array types in Pascal is > fixed. And it has to be fixed at a static value. Every array object of > a given type has the same fixed bounds. > > (Well, some version of Pascal added conformant arrays, which relaxed > this requirement for formal parameters.) That is true, in the same sense that some versions of Ada added modular types -- they were added to the standard.
From: Robert A Duff on 5 Sep 2005 19:46 Kilgallen(a)SpamCop.net (Larry Kilgallen) writes: > In article <wcck6hvnpsm.fsf(a)shell01.TheWorld.com>, Robert A Duff <bobduff(a)shell01.TheWorld.com> writes: > > "Jeffrey R. Carter" <spam(a)spam.com> writes: > > > >> Gene wrote: > >> > >> > -- 'First is not always 1. How marginally > >> > Ada! > >> > >> 'First is not always 1 (or 0, or X) is a basic concept in Ada. It's only > >> if you don't know, or forget, this, and assume the behavior you learned > >> in lesser languages, that you have problems. > >> > >> I came to Ada from Pascal, so I was used to the lower bound not being > >> fixed, > > > > Heh? The lower (and upper!) bound of all array types in Pascal is > > fixed. And it has to be fixed at a static value. Every array object of > > a given type has the same fixed bounds. > > > > (Well, some version of Pascal added conformant arrays, which relaxed > > this requirement for formal parameters.) > > That is true, in the same sense that some versions of Ada added > modular types -- they were added to the standard. Right. I was being vague because I couldn't remember whether conformant arrays were added in the first ISO Pascal standard, or the Extended Pascal version. I also can't remember the status of Extended Pascal (was it ever officially blessed by ISO?). Do you know? Conformant arrays were certainly not part of the original Pascal as documented in Jensen and Wirth's book, "Pascal User Manual and Report". And conformant arrays are only for parameters -- not normal variables, record components, heap objects, etc. Correct? - Bob
From: Robert A Duff on 5 Sep 2005 19:52 Jean-Pierre Rosen <rosen(a)adalog.fr> writes: > Robert A Duff a ýcrit : > > Why would you want an unconstrained array indexed by enumeration type? > > And why would you want an empty array if the array type is constrained? > > > I do that all the time, especially in ASIS programming. You may have > arrays indexed with subranges of declaration_kinds for example. Really? I can see why you might have: type Declaration_Kind is (This, That, Mumble, Dumble); subtype My_Kind is Declaration_Kind range This..That; subtype Your_Kind is Declaration_Kind range Mumble..Dumble; type A1 is array(My_Kind) of Blah; type A2 is array(Your_Kind) of Glorp; But do you really do this: type A is array(Declaration_Kind range <>) of Something; subtype A1 is A(My_Kind); subtype A2 is A(Your_Kind); "all the time"? Nothing wrong with it; I just think the former case would be by far more common. And do you create *empty* arrays indexed by enums? All the time? ;-) My empty arrays are usually indexed by signed integer types. - Bob
From: tmoran on 6 Sep 2005 01:25 > Heh? "Marginal utility" means the same as "not dirt common"! Exceptional intelligence is not "dirt common", but I believe it is of more than marginal utility.
From: Pascal Obry on 6 Sep 2005 01:38
Gene a ýcrit : > quickly added a comment, -- 'First is not always 1. How marginally > Ada! Maybe because Ada is good at modeling the problem-space and that arrays there do not necessary have numerical index and when it is the case they don't eventually start at 1. Others have pointed out lot of problems that are better modeled with non numerical indexes or indexes not starting at 1. Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595 |