On Thursday, 6 September 2012 at 12:22:08 UTC, David Nadlinger
wrote:
Can you elaborate on that? I must admit that I didn't actively
work on std.units for quite some while now, as general interest
in it seemed to have faded (I'm glad to be proven wrong,
though), but adding quantities of the same type should
definitely work.
Maybe I'm missing something fundamental, but this little test
fails:
---
auto foo = baseUnit!"foo";
auto foo2 = foo + foo;
---
Error: incompatible types for ((foo) + (foo)):
'BaseUnit!("foo",null)' and 'BaseUnit!("foo",null)'
And what do you mean by "different scopes"? If the unit types
are different, the quantity types should be different as well.
In the following, S1.foo and S2.foo are of the same type. I think
they shouldn't be; just like S1.Bar and S2.Bar are different
types.
---
struct S1 {enum foo = baseUnit!"foo"; struct Bar {}}
struct S2 {enum foo = baseUnit!"foo"; struct Bar {}}
---