Andrew this looks really great. Thanks for the contribution! On Fri, Feb 12, 2016 at 4:27 PM, Tim Holy <tim.h...@gmail.com> wrote:
> I have long been meaning to get around to making SIUnits type-stable under > arithmetic. I've only glanced at your code, but it looks like you just > scratched one big, bad TODO item off my list! Seems like you've included a > number of other nice features, too (many thanks for the microns support, it > will make a difference). I'll be excited to play with this. > > Best, > --Tim > > On Friday, February 12, 2016 12:23:22 PM Andrew Keller wrote: > > I'm happy to share a package I wrote for using physical units in Julia, > > Unitful.jl <https://www.github.com/ajkeller34/Unitful.jl>. Much credit > and > > gratitude is due to Keno Fischer for the SIUnits.jl > > <https://www.github.com/keno/SIUnits.jl> package which served as my > > inspiration. This is a work in progress, but I think perhaps a > serviceable > > one depending on what you're doing. > > > > Like SIUnits.jl, this package encodes units in the type signature to > avoid > > run-time performance penalties. From there, the implementations diverge. > > The package is targeted to Julia 0.5 / master, as there are some > > limitations with how promote_op is used in Julia 0.4 (#13803) > > <https://github.com/JuliaLang/julia/pull/13803>. I decided it wasn't > worth > > targeting 0.4 if the behavior would be inconsistent. > > > > Some highlights include: > > > > - Non-SI units are treated on the same footing as SI units, with only > a > > few exceptions (unit conversion method). Use whatever weird units you > > want. > > - Support for units like micron / (meter Kelvin), where some of the > > units could cancel out but you don't necessarily want them to. > > - Support for LinSpace and other Range types. Probably there are still > > some glitches to be found, though. > > - Support for rational exponents of units. > > - Some tests (see these for usage examples). > > > > Please see the documentation for a comprehensive discussion, including > > issues / to do list, as well as how to add your own units, etc. > > Comments and feedback are welcome. > > > > Best, > > Andrew Keller > >