From: David MacMahon Date: 2013-10-24T10:29:42-07:00 Subject: [ruby-core:58025] Re: [ruby-trunk - Feature #9049] Shorthands (a:b, *) for inclusive indexing On Oct 23, 2013, at 11:39 PM, Fuad Saud wrote: > How is a:b better than a..b? two dots are straightforward, unambiguous, well known. The tongue-in-cheek answer is that it's better because it's one character shorter. :-) The real answer is somewhat more subtle and perhaps subjective. Here are a few reasons. 1) The a:b form is more compact that a..b and the vertical dots of the ':' character stand out better (visually) than two horizontal dots when reading code: Proposed: foo[bar.x0:bar.x1, bar.y0:bar.y1, bar.z0:bar.z1] Current: foo[bar.x0..bar.x1, bar.y0..bar.y1, bar.z0..bar.z1] 2) The first:last form opens up the possibility of a first:step:last syntax for Ranges that have a step size other than 1. 3) It would make transliteration to Ruby of existing Matlab/OctavePython code easier. 4) It is more intuitive for new Ruby programmers who come from a Matlab/Octave/Python background. I'm not sure how much weight this reason carries (maybe negative? :-)) 5) Even if it's not deemed to be "better", it does provide another convenient way to make a Range. What's wrong with that? Dave