digitalmars.D.bugs - [Issue 7520] New: opDollar undocumented
- d-bugmail puremagic.com (17/17) Feb 16 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7520
- d-bugmail puremagic.com (15/15) Feb 04 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7520
- d-bugmail puremagic.com (42/42) Feb 28 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7520
- d-bugmail puremagic.com (10/10) Mar 02 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7520
- d-bugmail puremagic.com (9/9) Oct 26 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7520
- d-bugmail puremagic.com (9/9) Oct 26 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7520
http://d.puremagic.com/issues/show_bug.cgi?id=7520 Summary: opDollar undocumented Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: websites AssignedTo: nobody puremagic.com ReportedBy: robert octarineparrot.com 15:34:02 GMT --- There does not appear to be any documentation for opDollar on dlang.org. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 16 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7520 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com See Also| |http://d.puremagic.com/issu | |es/show_bug.cgi?id=3474 14:14:17 PST --- The feature was implemented in Issue3474 by https://github.com/D-Programming-Language/dmd/pull/442 I suggest Don and/or Kenji get on this since they know exactly how opDollar works. Apparently it can be a template, but I know very little about this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 04 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7520 hsteoh quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hsteoh quickfur.ath.cx I've used opDollar in some of my code; it appears to work like this: obj[$] gets lowered to obj.opIndex(obj.opDollar!0); obj[1,$] gets lowered to obj.opIndex(1, obj.opDollar!1); obj[1,2,$] gets lowered to obj.opIndex(1, 2, obj.opDollar!2); and so on. The $ is recognized in subexpressions as well, so: obj[1, func(2,$), 3] gets lowered to obj.opIndex(1, func(2, obj.opDollar!1), 3). In other words, the compile-time argument of opDollar is the index of position it appears in, in the arguments of the indexing operator. Unfortunately, it appears that only opDollar!0 is implemented for opSlice (besides, slicing syntax currently does not support multiple ranges). <aside> But even with the current opIndex and opDollar, one can hack around the lack of multidimensional opSlice by defining a custom range type, say: struct Range { int start,end; }, then you can overload opIndex to recognize pseudo-slicing syntax: obj[Range(1,2), Range(2,$)] gets translated to obj.opIndex(Range(1,2), Range(2,obj.opDollar!1)), so you just have to define: auto opIndex(Range r1, Range r2), and you can have pseudo-multidimensional slicing. One can even use variadic parameters to handle a mix of slicing and indexing: auto opIndex(R...)(R args) { foreach (arg; args) { static if (typeof(arg) : Range) { // slice this dimension } else if (typeof(arg) : indexType) { // index this dimension } } } The $'s are correctly translated to opDollar!i based on their position i in the [] operator, so this will correctly handle things like obj[$-1, Range(0,$-1)], obj[Range(0,$), 10], etc.. </aside> -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 28 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7520 hsteoh quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull https://github.com/D-Programming-Language/d-programming-language.org/pull/292 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 02 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7520 Commit pushed to master at https://github.com/D-Programming-Language/dlang.org https://github.com/D-Programming-Language/dlang.org/commit/2b6ff78b3d5148f9a3a9968fc1437a2a73d4fc45 Document opDollar (issue 7520) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 26 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7520 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 26 2013