Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like Ada's indexing range types, if you do it the right way your arrays can be 0-index or 1-index or indexed from 23 to 149. The bottomline is that in a good language it shouldn't matter and the programmer shouldn't even know how the compiler indexes the data. You iterate from array'first to array'last.

I do prefer 0-based indexing, of course, but often using indices can and should be avoided anyway.



Or indexed by any discrete type with a defined order, including enums and negative numbers. The latter being quite useful for signal processing.

Another thing to the add to the list of good ideas in Ada everyone ought to copy.


Ada ranges are closed intervals and need +1/-1 tweaks to handle a set of ranges.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: