Re: What do you think about managed code and OSes written in
Posted: Wed Feb 04, 2015 6:02 am
Hi,
What if I said "all arrays are of length N and must be indexed by an integer type that is only capable of storing values from 0 to N-1, for any value of N"?
Surely you can see this is just a minor extension to your 8-bit example. It's still easy to prove there are no bounds problems, and even though it's less limited, it's still too limited in practice.
Now, what if I said "all arrays of type T are of length Tn and must be indexed by an integer type that is only capable of storing values from 0 to Tn-1, for any value of Tn; but there can be many different array types each with their own independent Tn"?
Surely you can see this is just a minor extension to the previous minor extension of your 8-bit example. It's still easy to prove there are no bounds problems. Is it still too limited?
Finally, what if I said "all arrays of type T are of length Tn and must be indexed by an integer type that is either only capable of storing values from 0 to Tn-1 or can be proven to only hold a value from 0 to Tn-1, for any value of Tn; but there can be many different array types each with their own independent Tn"?
Surely you can see this is just another minor extension. It's still easy to prove there are no bounds problems. Is it still too limited?
Cheers,
Brendan
If I said "all arrays are of length 256 and must be indexed by an integer type that is only capable of storing values from 0 to 255", then it's easy to prove there are no bounds problems, but it is too limited in practice.HoTT wrote:The general case is where both your index and your array size may be the result of computation possibly involving input.
Of course you can say that all your arrays are of length 255 and are indexed by an 8-bit integer type. But then you introduced a big limitation already, one that I don't think is practical.
What if I said "all arrays are of length N and must be indexed by an integer type that is only capable of storing values from 0 to N-1, for any value of N"?
Surely you can see this is just a minor extension to your 8-bit example. It's still easy to prove there are no bounds problems, and even though it's less limited, it's still too limited in practice.
Now, what if I said "all arrays of type T are of length Tn and must be indexed by an integer type that is only capable of storing values from 0 to Tn-1, for any value of Tn; but there can be many different array types each with their own independent Tn"?
Surely you can see this is just a minor extension to the previous minor extension of your 8-bit example. It's still easy to prove there are no bounds problems. Is it still too limited?
Finally, what if I said "all arrays of type T are of length Tn and must be indexed by an integer type that is either only capable of storing values from 0 to Tn-1 or can be proven to only hold a value from 0 to Tn-1, for any value of Tn; but there can be many different array types each with their own independent Tn"?
Surely you can see this is just another minor extension. It's still easy to prove there are no bounds problems. Is it still too limited?
Cheers,
Brendan