Things that may be removed

bearophile bearophileHUGS at lycos.com
Wed Dec 17 06:33:55 PST 2008


Gide Nwawudu:
> Learning Pascal before C maybe toughen me up, I haven't
> suffered RSI typing ARRAY OF :)

But Pascal arrays have other qualities, an example:

type 
  TyArr = Array ['e' .. 'x'] of Integer;
var
  a1: TyArr;
begin
  a1['f'] := 10;
...

That array has that range of chars as indexes, and if you want the compiler at run time will control that only that range of chars is used. In D you can do that as (probably typedef is much less common in D code than the types section in Pascal programs):

typedef int['x' - 'e'] TyArr;
TyArr a1;
int main() {
    a1['f' - 'e'] = 10;
...

But maybe such things aren't common enough to deserve a special support.

Bye,
bearophile



More information about the Digitalmars-d mailing list