digitalmars.D.bugs - [Issue 6986] New: SortedRange[x..$] fails with unidentified __dollar
- d-bugmail puremagic.com (24/24) Nov 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6986
- d-bugmail puremagic.com (25/25) Nov 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6986
- d-bugmail puremagic.com (9/9) Nov 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6986
- d-bugmail puremagic.com (16/16) Nov 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6986
- d-bugmail puremagic.com (11/11) Nov 22 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6986
http://d.puremagic.com/issues/show_bug.cgi?id=6986 Summary: SortedRange[x..$] fails with unidentified __dollar Product: D Version: D2 Platform: x86_64 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: jlquinn optonline.net --- Comment #0 from Jerry Quinn <jlquinn optonline.net> 2011-11-21 22:35:06 PST --- dmd 2.056 Linux x64 import std.range; void foo(int[] buf) { auto bufsort = assumeSorted(buf); auto r = bufsort[1..$]; } ~/d/dmd2/linux/bin64/dmd -c range.d range.d(5): Error: undefined identifier __dollar -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 21 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6986 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com Platform|x86_64 |All OS/Version|Linux |All Severity|normal |enhancement --- Comment #1 from Jonathan M Davis <jmdavisProg gmx.com> 2011-11-21 22:57:17 PST --- Technically, this is an enhancement request, not a bug - though it's certainly a very desirable enhancement request. assumeSorted returns a SortedRange struct which wraps the range which was passed to it. SortedRange does not define opDollar, and at present, IIRC, opDollar hasn't been working correctly. So, it's not possible for SortedRange to define opDollar, and there's no way that your example is going to work. However, it looks like there was a commit made to dmd about an hour ago which relates to opDollar ( https://github.com/D-Programming-Language/dmd/commit/aba0f773416e1d45d227159cb22ad0e26bb980c0 ). So, it may now be possible to implement this. But the short answer for why this doesn't work is that $ doesn't yet work for anything other than built-in arrays, and assumeSorted doesn't return an array, even if you pass it one (and it would defeat the purpose of assumeSort if it did return an array). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 21 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6986 --- Comment #2 from Jerry Quinn <jlquinn optonline.net> 2011-11-21 23:06:36 PST --- I'd think the simplest solution would be to do the same rewrite that happens for builtin arrays, i.e. x[p..$] => x.opSlice(p, x.length) Then no opDollar is needed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 21 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6986 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|DMD |Phobos --- Comment #3 from Jonathan M Davis <jmdavisProg gmx.com> 2011-11-21 23:13:04 PST --- It doesn't work that way. opDollar is what's supposed to be used. I forget all of the reasons why, but I believe that it has to do with cases where opDollar would do something more complicated than simply opSlice(p, x.length). opDollar is more flexible for some set of cases, but they're not the sort of use cases that I normally think of, so I don't remember the exact details at the moment. I'd have to go digging through the newsgroup archives for discussions which related to it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 21 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6986 timon.gehr gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |timon.gehr gmx.ch --- Comment #4 from timon.gehr gmx.ch 2011-11-22 03:49:48 PST --- The rewrite from $ to .length does not work if a range has no predetermined length (eg. if it is infinite or corresponds to an input stream) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 22 2011