<div dir="ltr">On 24 March 2013 14:06, Jonathan M Davis <span dir="ltr"><<a href="mailto:jmdavisProg@gmx.com" target="_blank">jmdavisProg@gmx.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Sunday, March 24, 2013 13:55:26 Manu wrote:<br>
> I'd like to clarify some conflicts I've encountered.<br>
><br>
> TDPL talks about ranges, it mentions random access ranges requiring these<br>
> functions:<br>
><br>
>   T at(int i)<br>
>   Range slice(int x, int y)<br>
<br>
</div>This is not used by Phobos. I don't know why TDPL uses those. They are not<br>
supported at all and AFAIK never have been.<br></blockquote><div><br></div><div style>My mistake; I stumbled upon an article written in 'CDJ#++', which I thought was an exert from TDPL (mixed my browser tabs up) >_<</div>
<div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
> Also, forward ranges require:<br>
><br>
>   Range save()<br>
><br>
> But there is also this function:<br>
><br>
>   Range opSlice()<br>
><br>
> With no args, handles the syntax 'range[]'. save() and opSlice() with no<br>
> args would appear to be identical.<br>
> Why have both? Which will be used in which cases?<br>
<br>
</div>Range opSlice()<br>
<br>
is never used by ranges. It's only used by containers when you want to get a<br>
range for them.<br></blockquote><div><br></div><div style>So what's the difference between save() and opSlice() though? They appear to be identical regardless... is save() redundant?</div><div><br></div><div><br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If you want to know exactly which functions are supported by ranges, and the<br>
documentation isn't clear enough</blockquote><div><br></div><div style>This is my point, _there is no documentation_.</div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
just look at the definitions for the range<br>
traits in std.range - isInputRange, isForwardRange, etc. They specify exactly<br>
what a type must do to qualify as each type of range.<br></blockquote><div><br></div><div style>I have been, but since I'm just digging, and have no authoritative reference, I am easily confused when I see conflicting or apparently redundant code.</div>
<div style>A D user shouldn't have to do this. I encourage a section under Language -> Language Reference on <a href="http://dlang.org">dlang.org</a>, to anyone who is an authority on the topic.</div><div><br></div>
</div></div></div>