Generalize Ranges to support characters and other comparable values
Many other languages support the concept of a range that can be any sequence that meets simple criteria, beyond just integer sequences. I was looking to use a shorthand to create a list of characters from 'a' to 'z' but ranges only supports Integers, which means I needed to do
Range.from_to_inclusive(Char"a".to_int(), Char"z".to_int()).to_list().map(Char.from_int)
This could also apply to other kinds of sequences, such as dates.
Generalizing ranges is something we're interested in, but not focused on currently. There's some design questions to sort out, like whether ranges will be restricted to Comparable values or whether they'll accept any value and include a corresponding Comparator object.
start ..= end ranges also work as sequences, so I’d write
for List (i in Char"a".to_int() ..= Char"z".to_int()):
Char.from_int(i)
This is still sub-optimal, admittedly. Ideally, (Char"a" ..= Char"z").to_list() should work just fine.