Is it possible to talk about abstract types of units like size. e.g `drawline(s::Size) = ...`?
On Saturday, February 13, 2016 at 9:23:22 AM UTC+13, 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 >
