Duration at runtime

Zekereth via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 18 20:21:43 PST 2016


On Friday, 19 February 2016 at 04:16:23 UTC, Adam D. Ruppe wrote:
> On Friday, 19 February 2016 at 04:08:02 UTC, Zekereth wrote:
>> How is seconds able to be read at compile time but unitType 
>> cannot?
>
> "seconds" is a literal value that the compiler knows about. 
> unitType is a variable that might change between its 
> declaration and use (it doesn't here, but the compiler doesn't 
> check if it actually does, just if it *can*), so the compiler 
> doesn't allow it.

Thanks a lot Adam!

So is there a way around this?. I want duration to be 
configurable at runtime.


More information about the Digitalmars-d-learn mailing list