digitalmars.D.learn - DMD2, Phobos: striding range
- Mihail Strashun <m.strashun gmail.com> Mar 08 2010
- "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> Mar 08 2010
- Mihail Strashun <m.strashun gmail.com> Mar 08 2010
- Philippe Sigaud <philippe.sigaud gmail.com> Mar 08 2010
- Mihail Strashun <m.strashun gmail.com> Mar 26 2010
- Philippe Sigaud <philippe.sigaud gmail.com> Mar 26 2010
Following simple program fails to compile with latest DMD 2.041 (In fact it fails to compile with any dmd2 version i have tried): "test.d"import std.stdio; import std.range; import std.algorithm; int main() { auto test = stride( iota(0,10,1) , 2 ); return 0; }
Output: [mist mistwork d]$ dmd -run test.d /usr/include/d/std/range.d(716): Error: this._input.front() is not an lvalue /usr/include/d/std/range.d(724): Error: this._input.back() is not an lvalue Is it a bug? I managed to get stride working only on arrays. If it is the supposed way to work, how can be similar filtering done on ranges?
Mar 08 2010
Mihail Strashun wrote:Following simple program fails to compile with latest DMD 2.041 (In fact it fails to compile with any dmd2 version i have tried): "test.d" > import std.stdio; > import std.range; > import std.algorithm; > > int main() > { > auto test = stride( iota(0,10,1) , 2 ); > return 0; > } Output: [mist mistwork d]$ dmd -run test.d /usr/include/d/std/range.d(716): Error: this._input.front() is not an lvalue /usr/include/d/std/range.d(724): Error: this._input.back() is not an lvalue Is it a bug? I managed to get stride working only on arrays. If it is the supposed way to work, how can be similar filtering done on ranges?
It's definitely a bug. I've reported it: http://d.puremagic.com/issues/show_bug.cgi?id=3894 -Lars
Mar 08 2010
Thanks! Lars T. Kyllingstad wrote:Mihail Strashun wrote:Following simple program fails to compile with latest DMD 2.041 (In fact it fails to compile with any dmd2 version i have tried): "test.d" > import std.stdio; > import std.range; > import std.algorithm; > > int main() > { > auto test = stride( iota(0,10,1) , 2 ); > return 0; > } Output: [mist mistwork d]$ dmd -run test.d /usr/include/d/std/range.d(716): Error: this._input.front() is not an lvalue /usr/include/d/std/range.d(724): Error: this._input.back() is not an lvalue Is it a bug? I managed to get stride working only on arrays. If it is the supposed way to work, how can be similar filtering done on ranges?
It's definitely a bug. I've reported it: http://d.puremagic.com/issues/show_bug.cgi?id=3894 -Lars
Mar 08 2010
--00151758a64487ef710481513d31 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Mar 8, 2010 at 13:00, Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:It's definitely a bug. I've reported it: http://d.puremagic.com/issues/show_bug.cgi?id=3894
std.range use ref everywhere. I had to comment them out to get any composition to work. But the 'auto ref' feature added a release ago was made to solve this problem, I guess. Full-blown propagation of ref when you can have it, graceful stop when you cannot. Hmm, I should try this as soon as I won't have a baby sleeping on me... --00151758a64487ef710481513d31 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <br><br><div class=3D"gmail_quote">On Mon, Mar 8, 2010 at 13:00, Lars T. Ky= llingstad <span dir=3D"ltr"><public kyllingen.nospamnet></span> wrote= :<br><blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; = border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> <div><div></div>It's definitely a bug. =A0I've reported it:<br></di= v> <br> <a href=3D"http://d.puremagic.com/issues/show_bug.cgi?id=3D3894" target=3D"= _blank">http://d.puremagic.com/issues/show_bug.cgi?id=3D3894</a><font color= =3D"#888888"></font></blockquote><div><br>std.range use ref everywhere. I h= ad to comment them out to get any composition to work. But the 'auto re= f' feature added a release ago was made to solve this problem, I guess.= Full-blown propagation of ref when you can have it, graceful stop when you= cannot.<br> <br>Hmm, I should try this as soon as I won't have a baby sleeping on m= e...<br><br></div></div> --00151758a64487ef710481513d31--
Mar 08 2010
Philippe Sigaud wrote:On Mon, Mar 8, 2010 at 13:00, Lars T. Kyllingstad <public kyllingen.nospamnet> wrote: It's definitely a bug. I've reported it: http://d.puremagic.com/issues/show_bug.cgi?id=3894 std.range use ref everywhere. I had to comment them out to get any composition to work. But the 'auto ref' feature added a release ago was made to solve this problem, I guess. Full-blown propagation of ref when you can have it, graceful stop when you cannot. Hmm, I should try this as soon as I won't have a baby sleeping on me...
Hm, changing "ref" on lines 716 and 724 to "auto ref" changes nothing. Changing it to simply "auto" seems to solve problem. How "auto ref" feature is supposed to work? This ( http://www.digitalmars.com/d/2.0/function.html ) description tends to match problem with stride, but as I have just said, it gives same error.
Mar 26 2010
--0003255565322e03bf0482bae87b Content-Type: text/plain; charset=ISO-8859-1 On Fri, Mar 26, 2010 at 11:16, Mihail Strashun <m.strashun gmail.com> wrote:Hm, changing "ref" on lines 716 and 724 to "auto ref" changes nothing. Changing it to simply "auto" seems to solve problem. How "auto ref" feature is supposed to work? This ( http://www.digitalmars.com/d/2.0/function.html ) description tends to match problem with stride, but as I have just said, it gives same error.
Then we both do not understand what auto ref functions can do. Or maybe it's still a bit buggy? --0003255565322e03bf0482bae87b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <br><br><div class=3D"gmail_quote">On Fri, Mar 26, 2010 at 11:16, Mihail St= rashun <span dir=3D"ltr"><<a href=3D"mailto:m.strashun gmail.com">m.stra= shun gmail.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" s= tyle=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204= ); padding-left: 1ex;"> Hm, changing "ref" on lines 716 and 724 to "auto ref" c= hanges nothing. Changing it to simply "auto" seems to solve probl= em.<br> <br> How "auto ref" feature is supposed to work? This ( <a href=3D"htt= p://www.digitalmars.com/d/2.0/function.html" target=3D"_blank">http://www.d= igitalmars.com/d/2.0/function.html</a> ) description tends to match problem= with stride, but as I have just said, it gives same error.<br> </blockquote></div><br>Then we both do not understand what auto ref functio= ns can do. Or maybe it's still a bit buggy?<br><br><br><br><br> --0003255565322e03bf0482bae87b--
Mar 26 2010









Mihail Strashun <m.strashun gmail.com> 