"bearophile" <[email protected]> wrote in message news:[email protected]... > 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
VB6 (and maybe VBScript) allows the lower bound of an array to be any interger less than whatever the upper bound is. Personally, I've never liked that. The mere possibility for that forces all code that uses arrays to use the ugly "UBound(array) - LBound(array)" to get length (unless you want to write and use a non-standard array length function) and start all iterations at "LBound(array)" instead of 0. Then again, since D has ".length" and "foreach", those might not be problems for D. I think Andrei has previously suggested the idea of dropping the keyword "new" from class instantiations / heap allocations. I wouldn't like that. The "new" makes class instantiations / heap allocations easily greppable. I don't think I would want to give that up. Also, as far as the quoted in the original post (such as "Perfection is attained, not when no more can be added, but when no more can be removed."). I normally agree with such sentiment, but I don't consider it to bve particularly applicable to language design. I see a progamming langauge as being not a tool, but a toolbox. You wouldn't design a real carpentry/construction/etc. toolbox with a "Perfection is attained, not when no more can be added, but when no more can be removed." philosophy, would you? If you did, it would end up containing nothing but a hammer and a note saying "If all you have is a hammer, everything looks like a nail". If you did it with language design, you'd ultimately end up with brainfuck.
