Hi Everyone,

I am trying to improve units of measurements usability I currently have in Nim.

Basic idea is if value is compile time zero than it is automatically 
convertible to other unit of measurement.

For example, I have the following type definition
    
    
    type Kg = distinct float
    
    
    Run

I am trying to write converter that converts `0.0` float to `Kg` automatically, 
but only zero. Other values should require explicit conversion. I have tried so 
far 
    
    
    converter mykg_conv(x: range[0.0 .. 0.0]{lit} = x.Kg
    
    
    Run

doesn't work, as far as I call tell because `0.0 is range[0.0 .. 0.0]` returns 
`false`.

Any clever tricks I can use to achieve much desired effect? Possible I can 
utilize `static[T]` in some way?

Thank you

Reply via email to