ceylon/ceylon-spec — Issue #99: Should we have an operator for expressing ranges as start/length
Author: gavinking
Created: 2011-12-11 16:41:20+00:00
State: open
Labels: request for feedback

We have the syntax `start..end` for expressing inclusive ranges (what I've been calling spans). This makes an appearance in two different operators, for example:

for (i in 0..end) { ... }
for (x in seq[0..end]) { ... }

In this thread:

http://groups.google.com/group/ceylon-dev/browse_thread/thread/82daa1e0750f133a?hl=en

The idea of having an operator for expressing ranges by start and length (what I've been calling segments) came up. The syntax I like the most would be a `:`, but I think that `..:` or `../` could also potentially work.

for (i in 0:length) { ... }
for (x in seq[0:length]) { ... }

Now, `:` is a potentially very useful symbol, so I'm a little loathe to "waste" it on something non-critical like this. So a different possibility would be something like `..:` or `../`.

Anyway, this is not going to be for M1, it's just an idea that is out there to see if it would be popular with other folks.