3 ms·
I don't think it even needs to be a range, you can index using enums
by Avshalom 6y ago
I don't think it even needs to be a range, you can index using enums
- Jtsummers 6y agoWell, "range" was not the correct term. What I meant is that you can't treat the source as sparse. You can't skip portions of it. So you can't make an array that only covers every other element of this enumeration: type Colors is (Red, Green, Blue, Black, Gray, White); It has to be a consecutive group of them, taken in order, as the specification of even this enumeration has an ordering to it as far as Ada is concerned. So I can make an array using all of Colors as the index, or some subset but it has to be, say, Red..Blue and not Red|Blue skipping over Green.
- Lucretia9 6y agoAda 2012 allows you to define gaps, this is my best example I have available https://github.com/Lucretia/sdlada/blob/master/src/sdl-video-pixel_formats.ads#L87 https://github.com/Lucretia/sdlada/blob/master/src/sdl-video...
- Jtsummers 6y agoThat is great to read, and probably a sign that my learning materials should be updated. I'll try to remember this in the future.