digitalmars.D.bugs - [Issue 5891] New: hasLength!iota is false
- d-bugmail puremagic.com (26/26) Apr 26 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5891
- d-bugmail puremagic.com (20/20) Apr 26 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5891
- d-bugmail puremagic.com (13/13) May 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5891
- d-bugmail puremagic.com (7/11) May 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5891
http://d.puremagic.com/issues/show_bug.cgi?id=5891
Summary: hasLength!iota is false
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: regression
Priority: P2
Component: Phobos
AssignedTo: nobody puremagic.com
ReportedBy: dsimcha yahoo.com
With the latest SVN versions of Phobos and DMD the following static assert
fails:
import std.range;
void main() {
auto myIota = iota(1000);
static assert(hasLength!(typeof(myIota)));
}
IMHO this is a blocker for releasing 2.053 because iota is very frequently used
with parallel foreach loops and parallel foreach is much less efficient if
iterating over a range without a length.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 26 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5891
kennytm gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kennytm gmail.com
(SVN? You mean git?)
The problem is length() is an auto-return function, and somehow typeof() cannot
find the return type from this function:
--------------------------------------------------
import std.range;
struct X { property auto length() { return 0; } }
pragma(msg, typeof(X.init.length)); // ()
--------------------------------------------------
Because of this, is(typeof(X.init.length) : ulong) cannot be true, and return
hasLength returns false.
This is more a DMD problem than a Phobos problem.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 26 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5891
David Simcha <dsimcha yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Of course the DMD bug should be fixed but Iota is too important to fail, so
this specific case has been worked around:
https://github.com/D-Programming-Language/phobos/commit/9c7fe081f8ec5cec6822f3801b3dee6a85d22e45
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 05 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5891Of course the DMD bug should be fixed but Iota is too important to fail, so this specific case has been worked around: https://github.com/D-Programming-Language/phobos/commit/9c7fe081f8ec5cec6822f3801b3dee6a85d22e45OK. The DMD bug is now filed as issue 5933. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 06 2011









d-bugmail puremagic.com 