std.v2020.algorithm etc[ WAS: Is run.d going to be expand for runtime and the phobos library?]
Stanislav Blinov
stanislav.blinov at gmail.com
Sat Jun 27 20:14:36 UTC 2020
On Saturday, 27 June 2020 at 18:55:39 UTC, Paul Backus wrote:
> On Saturday, 27 June 2020 at 17:30:54 UTC, Stanislav Blinov
> wrote:
>>
>> Thereby result of (input.tail == input.tail) is a coin flip? I
>> don't think that's a sensible design.
>
> Equality is not part of the range interface (current or
> proposed), so there is no guarantee that comparing two ranges
> with `==` will give you a useful result.
Equality is very much part of the struct interface though. I'll
restate. What about input.tail.empty == input.tail.empty? Or
input.tail.front == input.tail.front? Or, speaking of ranges, a
input.tail.equal(input.tail)?..
I thought you were concerned about having to explain something to
beginners ;)
If the explanation is "`tail() const` is impure, and calling it
repeatedly with the same `this` produces different results, even
when `this` is immutable", "WTF???" would be quite a reasonable
follow-up question. This is not malloc. If we do define a `tail`
primitive, it better yield the same output for the same input,
meaning it would only be a primitive of forward ranges.
More information about the Digitalmars-d
mailing list