Forcing compile time evaluation of pure functions

scarrow shawn.baird at gmail.com
Wed Jun 29 22:18:47 PDT 2011


Oh, I also wanted to mention that although ideally I'd be able to invoke the
compile time and runtime versions identically and have it automatically select,
I'm also worried about accidentally invoking the runtime version when I should
have been using the compile time version.  I can't think of a way to make it:

    string s = "foo";
    auto h = Hash("foo");    // I'd like it to fail but doesn't
    auto i = CHash!("foo");  // works fine (compile time)
    auto j = Hash(s);        // works fine (runtime)
    auto k = CHash!(s);      // fails as it should




More information about the Digitalmars-d-learn mailing list