On Oct 23, 2013, at 10:36 PM, boris_stitnicky (Boris Stitnicky) wrote:

> @david_macmahon: I do not think that the wish to make a : b an alias =
of a .. b
> can fit into the language anymore. "x > 0 ? 1 : 2 : 3" could be =
ambiguously
> parsed as "x > 0 ? ( 1 : 2 ) : 3" or as "x > 0 ? 1 : ( 2 : 3 )"...

Good point.  How about if this new notation limited only to uses within =
square brackets: `[a:b]`?  There are two distinct cases (maybe more?).  =
One case is where this used as a literal like `range =3D [a:b]` and the =
other where it is used in #[] like `array[a:b]`.

It may seem strange for `[...]` to create a non-Array literal, but the =
usage would be pretty straightforward:

```ruby
[a:b]      =3D> a..b
[a:b, c:d] =3D> [a..b, c..d]
[[a:b]]    =3D> [a..b]
```

With this case, your example of `x > 0 ? 1 : 2 : 3` would not be =
syntactically valid, but it could, for example, be re-written as `x > 0 =
? [ 1 : 2 ] : 3` (excessive spaces added for emphasis), which would be =
equivalent to `x > 0 ? 1 .. 2 : 3`.

The two cases are mutually exclusive (unless there is some parsing =
constraint I'm unaware of).  The #[] case would be the more useful of =
the two (by far, IMHO).  The [a:b] case doesn't really offer much over =
the a..b syntax (except for possible consistency with the #[] case).

Dave