paholg / dimensioned

Compile-time dimensional analysis for various unit systems using Rust's type system.
https://crates.io/crates/dimensioned
MIT License
300 stars 23 forks source link

Rename Dim #11

Closed iliekturtles closed 8 years ago

iliekturtles commented 8 years ago

A pedantic breaking changing. Please close if you believe this is too much breakage.

The current struct has dimensions, but it seems awkward to also call it Dim. I believe the current Dim struct should be renamed to Quantity . Given a system of quantities (SI) each quantity can be defined in terms of a quantity dimension and base quantity.

paholg commented 8 years ago

Hey, sorry I haven't been around ... some things came up.

I don't think this is too much breakage, but I also don't really see what it does, especially if we end up with types like Meter<f64> instead of Dim<Meter, f64>, in which case users shouldn't have to interact with this struct much if at all.

In any case, it would be easy to add an alias type Quantity<D, V> = Dim<D, V>, but that doesn't change error messages.

iliekturtles commented 8 years ago

The intention was just to rename the struct to better match what it actually means and reduce any confusion between the SI dimensions (length, mass, ...) and the current Dim struct which has dimensions but is and quantity.

(My latest experiments are at https://github.com/iliekturtles/uom/tree/dev-8. I have a Quantity struct with dimension and base unit parameters. It optimizes well in simple cases but doesn't quite vectorize perfectly for some reason.)

paholg commented 8 years ago

This struct no longer exists in the new formulation of dimensioned, so its name is no longer relevant.