[Issue 6725] core.time.dur should accept floating point

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 21 12:35:19 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=6725

--- Comment #15 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Jonathan M Davis from comment #11)
> 
> I'm not opposed to something like durLit!("1.2552", "seconds") which is then
> essentially a Duration literal which can be a floating point value. However,
> using floating point values for time at runtime is just begging for bugs,
> and such code should be avoided with extreme prejudice.

I don't agree with that. It depends on the purpose of the duration value. Note
that Objective-C uses Interval to represent all durations, and it is a typedef
of double. I have not had any adverse experience with it.

(In reply to Vladimir Panteleev from comment #12)
> I'd just like to point out that there are more uses to FP time values than
> literals, such as user input. A template which accepts a string as a
> compile-time parameter solves none of my personal use-cases.

Such a template can be built from a CTFE-able function, which would be
available at runtime as well.

--


More information about the Digitalmars-d-bugs mailing list