From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cc4f25d878383cc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-14 09:47:43 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Dimensionality Checking (Ada 20XX) Date: 14 Dec 2001 12:38:02 -0500 Organization: NASA Goddard Space Flight Center Message-ID: References: <11bf7180.0112070815.2625851b@posting.google.com> <9v0crt$bo2bi$1@ID-25716.news.dfncis.de> <9v37rs$cdmva$1@ID-25716.news.dfncis.de> <9v5loh$d5aki$1@ID-25716.news.dfncis.de> <9v6iv7$dcrbf$2@ID-25716.news.dfncis.de> <9vb860$e8rbj$1@ID-25716.news.dfncis.de> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1008351680 28390 128.183.220.71 (14 Dec 2001 17:41:20 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 14 Dec 2001 17:41:20 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Xref: archiver1.google.com comp.lang.ada:17918 Date: 2001-12-14T17:41:20+00:00 List-Id: "Nick Roberts" writes: > "Stephen Leake" wrote in message > news:upu5kjzgq.fsf@gsfc.nasa.gov... > > > Many (most?) of the required inter-type operations will be provided as > > > predefined operations. This in itself is not a big change, since Ada 95 > > > already provides it! > > > > Um, no. In Ada 95, I can do: > > > > type Meters is digits ...; > > type Seconds is digits ...; > > type Meters_Per_Second is digits ...; > > > > Ada 95 does _not_ define the following, which is needed: > > > > function "/" (Left : in Meters; Right in Seconds) return > > Meters_Per_Second; > > It does if you use fixed point instead of floating point types. This was one > of the reasons why I felt it would be harder to add units to floating point > types. Ah. LRM 4.5.5 (19). I had forgotten that. > > If X is to be passed to a transcendental function, yes, it must be > > dimensionless. But that's _not_ what I'm doing with X! I am > > _defining_ the position of the end of a robot arm to be V == (x, > > y, z). By _definition_, x, y, and z are in meters. As such, it is > > _meaningless_ to pass x to a transcendental function. That's fine; > > the mathematical meaninglessness simply reflects a physical > > meaninglessness. There is no meaninful physical operation that > > corresponds to Sin (meters). > > So why did you give it as an example? Well, I guess it was confusing. I was overloading X, and the overload resolution algorithm was not clear. That's why I like specifying algorithms in Ada, instead of in Math :). -- -- Stephe