Path: utzoo!utgpu!watserv1!watmath!att!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.misc Subject: Re: Typing on units Message-ID: <16248@haddock.ima.isc.com> Date: 21 Mar 90 21:41:05 GMT References: <39941@ism780c.isc.com> <883@enea.se> <40346@ism780c.isc.com> <907@enea.se> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 23 In article <907@enea.se> sommar@enea.se (Erland Sommarskog) writes: >Marvin Rubenstein (marv@ism780.UUCP) writes: >>[about having dimensional analysis built into a language] > >I was fully aware of what I proposed was not really what you wanted, >on the other hand, I don't see any important conceptual difference >in your out-line. Your notation is far more compact that the Ada >package you would have to write, but once you would had it done, >you could go ahead and program your computation. And the package >would still be there the next time. The problem is that there are a *lot* of distinct types: a true dimensional analysis language would accept "meter^3/(kilogram*second^2)" automatically; in Ada it works only if the package author had the foresight to include it. >[One pitfall in Ada is that you] have to rely on a conversion routine: > Real_world_distance := Feet_to_meter(US_distance); Or just use a predefined constant of the appropriate type: Real_world_distance := METERS_PER_FOOT * US_distance; since the dimensional analysis will keep you from doing it backwards. Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint