[Issue 9214] New: TickDuration.to should probably be a property

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 26 17:51:56 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=9214

           Summary: TickDuration.to should probably be a property
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-12-26 17:51:54 PST ---
Example from datetime:

import std.datetime;
import std.stdio;
import std.conv;
void main()
{
    int a;
    void f0() {}
    void f1() {auto b = a;}
    void f2() {auto b = to!(string)(a);}
    auto r = benchmark!(f0, f1, f2)(10_000_000);
    writefln("Milliseconds to call fun[0] n times: %s", r[0].to!("msecs",
int));
}

2.060: test.d(12): Error: not a property r[cast(uint)0].to

If we want to preserve this syntax we have to make the `to` function a
property. Or we can change the code sample.. but I kind of like the way it's
written.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list