digitalmars.D.bugs - [Issue 10828] New: datetime toString functions should accept sink
- d-bugmail puremagic.com (32/32) Aug 15 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10828
http://d.puremagic.com/issues/show_bug.cgi?id=10828 Summary: datetime toString functions should accept sink Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: monarchdodra gmail.com Basically, all datetime functions' "toString" signature are: "string toString();" There should be an overload which accepts a sink (eg:) "const void toString(scope void delegate(const(char)[]) sink);" Without this, code such as: writeln(currentTime) Will needlessly allocate a string. This is an issue for this user: http://forum.dlang.org/thread/ofelyiymbyywethtfjxh forum.dlang.org#post-ypgppdursxtwljhkjoed:40forum.dlang.org Who wants to log the time at which destruction happens. This leads to a: core.exception.InvalidMemoryOperationError Due to an allocation during a collect. Implementation should be "trivial"*, since the implementation of "toString" is basically "return format("%%%%", args)". So this can "easily" be changed to: "formattedWrite(sink, "%%%%", args)" -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 15 2013