digitalmars.D.bugs - [Issue 6793] New: std.exception.assumeUnique documentation
- d-bugmail puremagic.com (40/40) Oct 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6793
http://d.puremagic.com/issues/show_bug.cgi?id=6793 Summary: std.exception.assumeUnique documentation Product: D Version: D2 Platform: Other OS/Version: Other Status: NEW Severity: enhancement Priority: P2 Component: websites AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc In the site documentation of std.exception.assumeUnique there is code like: string letters() { char[] result = new char['z' - 'a' + 1]; foreach (i, ref e; result) { e = 'a' + i; } return assumeUnique(result); } But recent improvements of the D language make assumeUnique useless in this case, this compiles: string lowercase() pure nothrow { auto result = new char['z' - 'a' + 1]; foreach (i, ref c; result) c = cast(char)('a' + i); return result; } void main() {} On the other hand currently (DMD 2.056head) 'a'+i can't be assigned to a char because the compiler doesn't see that the variable 'i' will never become too much big. So in the documentation of std.exception.assumeUnique I suggest to explain that some usages (where the function is pure) of assumeUnique are not needed now. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 08 2011