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.1 required=5.0 tests=BAYES_20,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,791ecb084fdaba75 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-09-28 12:01:21 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swrinde!news.dell.com!tadpole.com!uunet!winternet.com!mr.net!usenet From: "Paul Pukite" Newsgroups: comp.lang.ada Subject: Re: Types with physical dimension Date: Wed, 28 Sep 94 13:28:14 CST Organization: Minnesota Regional Network Message-ID: <60852.pukite@daina.com> Reply-To: NNTP-Posting-Host: msp2-15.nas.mr.net X-Minuet-Version: Minuet1.0_Beta_16 X-POPMail-Charset: English To: graham@clsi.COM Date: 1994-09-28T13:28:14-06:00 List-Id: Paul Graham wrote: >One can model physical types in Ada by using private types, but this >involves writing a lot of operators. What do Ada programmers do to guard >against dimensional errors? You don't necessarily need to invoke private types in Ada. By creating a derived type like: type Dollars is new INTEGER; -- Also can put in range constraints you cannot multiply two dollar objects in another package unless you specifically state that you want the "*" operator used. (Ada 9X reduces the extra code required to "use" the "*".) This guards against some of the dimensional errors as do the range constraints, but I agree that VHDL physical types are rather neat. -- Paul Pukite (pukite@daina.com) DAINA Engineering 612/781-7600 4111 Central AVE NE, Suite 212 Minneapolis, MN 55421-2953