On 13 May 2013 11:21, Florian Weimer <fwei...@redhat.com> wrote: > On 04/18/2013 01:08 AM, Björn Persson wrote: > >> Florian Weimer wrote: >> >>> Yes, Ada has some nice features. At least there are real arrays, but >>> they are somewhat cumbersome to work with, compared to Java, Python or, >>> well, C pointers. There are two aspects: preservation of array bounds >>> in slices (so that you have to write Table (Table'First + Offset) to >>> access the element Offset of Table, Offset ranging from 0 to >>> Table'Length - 1) >>> >> >> That array bounds must be preserved becomes obvious when you consider >> arrays where the index type has a meaning beyond just position in the >> array. If you have an array Week with a range of Monday..Sunday, and >> you take the slice Week(Saturday..Sunday) and call it Weekend, then you >> really don't want Weekend to suddenly have the indexes Monday and >> Tuesday. >> > > Weekdays are a very bad example because it is locale-dependent whether > Monday < Sunday or the other way round. So you really can't fit them well > into an enumeration type, and Java 8 orders the enumeration values > alphabetically by their name, to make that point perfectly clear. > > I suppose a week actually looks like a ring buffer rather than a linear array. Week(Saturday..Sunday) would make sense in that context, but it'd take someone more familiar with esoteric languages than me to say whether there's any language that provides that (not a feature much in demand I'd think).
-- imalone http://ibmalone.blogspot.co.uk
-- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel