| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Storing units in the database
Marshall,
you said:
....
4) define a type m 5) define a type m^2 6) define an operation * on m that yields m^2...
Of course this is doable. But the question is: are types "m^2", "m^3" a good and practical approach ? I don't think so. There are algebraically relationships between them. How would you relate the types "m", "m^2", "m^3"? How would we handle Kilo, Mega etc ?
I believe, as Mikito, this approach is not practical. It's not done in physics that way. There are no types in physics. Instead we use algebra on "symbols". There are no symbols in mainstream programming languages and database systems and that's not good.
Greeting from Croatia,
Drago Ganic
"Marshall Spight" <marshall.spight_at_gmail.com> wrote in message
news:1121224244.590976.110920_at_g14g2000cwa.googlegroups.com...
> Mikito Harakiri wrote:
>> Marshall Spight wrote: >> > >> > I believe that C++, for example, has everything you need to >> > be able to do this sort of thing in the type system. I am >> > not aware, however, of any body of people finding it to be >> > worth the effort. >> >> Again, type system has little to offer. >> >> Adding >> >> 5 * lbs + 5 * kg >> >> is perfectly legal, although depends upon "lbs" defintion. If >> >> lbs = 0.4 * kg >> >> then we simply substitute. Then we apply distributive law. How about >> adding velocity to distance? Why not: >> >> 5 * m / c^2 + 20 * m >> >> We can apply a distributive law again >> >> (5 / c^2 + 20) * m >> >> but we fail to isolate unit symbols in a separate factor. >
>> 6) define an operation * on m that yields m^2
> 1) define a type lbs
> 2) define a type kg
> 3) define implicit conversions from one to the other
> 4) define a type m
> 5) define a type m^2
>
> > >
![]() |
![]() |