4 ms·
The comment to which I replied is about two concepts: Defining subtypes and an optimization made possible by them. I get a lot of value out of compile time enf
by mcculley 1y ago
The comment to which I replied is about two concepts: Defining subtypes and an optimization made possible by them.
I get a lot of value out of compile time enforcement of subtypes (e.g., defining a function as requiring a parameter be Index instead of Integer) finding errors in my thinking. It is more than "cute" to me.
As for the possible optimization of the array bounds check and it happening at runtime instead of compiletime, isn't that a failure of GNAT and not Ada? Can't a sufficiently smart compiler detect the problem in your example?
Regardless, I am not convinced that getting around the compiletime type safety by casting with Integer'Value(Integer'Image(X)) proves anything. I will still prefer having subtypes over not having them.