# meaning of "range" - use "interval" instead?

Larry's updating the Synopsis terminology to say "sequence" instead of "series" for correctness led me to check out what seems to be a similar problem, "range".
```
```
I believe that the Synopsis should just use the term "interval" for what it currently calls "range" (and "Interval" for "Range"); currently it uses both terms and Perl 6 has related types named "Range" and "RangeIter".

```
The problem stems from "range" having multiple relevant meanings in practice:

```
1. A "where" or "region" kind of meaning, where it is used in the same way as "interval", as being a collection of everything between 2 locations/points.
```
```
2. A "how much" or "distance" kind of meaning, where it is the (scalar) distance between 2 locations/points.
```
```
The relationship between these is like a generalization of the relationship between a temporal interval (with 2 temporal instant endpoints) and a temporal duration.
```
```
There is also a third meaning of "range" meaning the set of possible output values of a function, corresponding to "domain" as the set of possible inputs.
```
```
I believe that the name Interval is much more specific to the meaning that Range is going for, without having the other meanings that can confuse, while Range is more likely to confuse.
```
In particular, what would someone expect a function named range() to do?

```
It is often the case that range() would be expected take a nonempty set of numbers and return a number that is the difference between the largest and smallest numbers in the set. For example, "range(5,-3,0,6,2,-1)" would return 9 (6-(-3)); similarly, "range(25..52)" would return 27.
```
```
A range() function would be in the same category of functions as mean(), median(), mode(); each takes a nonempty set of numbers and returns a single number.
```
```
Now if Range were renamed to Interval, I don't see this as being a problem for anyone. Sure, Interval is a longer word, but how often would the name of that type be written out in code? Usually one produces an interval using ".."/etc notation anyway.
```
```
As for places you want to abbreviate, I recommend "Ivl" ("Int" won't work, obviously); it looks visually different and emphasizes distinct sounds. For example, with "IvlIter"; granted, this doesn't read as well as "RangeIter", but would either appear in code that often anyway and not be more of an internal thing that's used implicitly?
```
```
So then, just use "interval" etc for that meaning and just use "range" for other meanings such as high-low distance or the output of a function, or just use it less.
```
```
The main wrinkle I can see here is if you were deliberately using "range" *because* it has multiple meanings, to try and convey all of those meanings at once. While that may work in some cases, it seems *too* clever in this case. And if you want to say that, eg, casting a Range object as an integer returns the difference between its endpoints (meaning #2), Interval works for that too.
```
-- Darren Duncan

```