D3 suggestion: rename "range" to "sequence"
Tommi
tommitissari at hotmail.com
Wed Oct 3 22:57:45 PDT 2012
On Thursday, 4 October 2012 at 05:18:20 UTC, Walter Bright wrote:
>
> I wish to point out that order doesn't necessarily matter with
> a range, so there is not a 1:1 correspondence with a sequence.
>
> For example, the ordering of elements in an associative array
> is arbitrary.
Oh, right. I guess in the following function, S would be a
sequence if fun returned always false, as long as a != b.
bool fun(S, E : ElementType!S)(E a, E b)
{
S s1, s2;
s1.put(a);
s1.put(b);
s2.put(b);
s2.put(a);
return s1 == s2; // S is a sequence, if always returns false
// S is a set, if always returns true
}
So, if S is an associative array, fun can (and most likely will)
return true. Good that it's not called a sequence then. It would
be confusing if the meaning of the terms matched only 99% of the
time.
More information about the Digitalmars-d
mailing list