Paulo Pinto:

That is why most safe systems programming language compilers allow disabling bounds checking. :)

Disabling bounds checking (BC) is an admission of defeat (or just of practicality over technical refinement).

Various languages approach the situation in different ways, some examples:
- Python has BC, and it can't be disabled.
- Java has BC, but with the large engineering efforts done on the OracleVM, some array accesses are proved to be in-bound, and removed (some BC is removed thanks to inlining). The effect of this optimization is visible for matrix-processing code, etc. (It's not a large effect, but it's useful, and it could be handy to have in D too).
- D has BC, but you can disable it for each compilation unit.
- Ada is like D, but its stronger typing (and the strongly typed style most Ada programs are written! because it's also a matter of how you use a language) allows the compiler to optimize away some BC with very simple means, without the need for the analysis done by the OracleVM.

Bye,
bearophile

Reply via email to