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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1901f265c928a511 X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.gbronline.com!news.gbronline.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 01 Jun 2004 09:35:52 -0500 Date: Tue, 01 Jun 2004 09:36:23 -0500 From: Wes Groleau Reply-To: groleau+news@freeshell.org Organization: Ain't no organization here! User-Agent: Mozilla Thunderbird 0.5 (Macintosh/20040208) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Typing in Ada References: <2i1t1lFij4g5U1@uni-berlin.de> <9ZRuc.8410$hB2.7017@nwrdny03.gnilink.net> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 69.9.86.80 X-Trace: sv3-dHt82EFSjOgz0BOyB0xGW8K9YRCyMwErQR98GZORoghkJBVAeCkzFKfqiWmm2MukXadG01Q9RrNafxq!ZCQIlw61WKaokOE0TuFuR7a8hNeXTh+3EukGoYKIhN33HDPQqzUUrmgpGn80RimG4dekGYwtu+bF X-Complaints-To: abuse@gbronline.com X-DMCA-Complaints-To: abuse@gbronline.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: controlnews3.google.com comp.lang.ada:992 Date: 2004-06-01T09:36:23-05:00 List-Id: Dennis Lee Bieber wrote: > On Tue, 01 Jun 2004 02:36:53 GMT, Hyman Rosen >>limited. In a real program that does something useful, what kinds >>of things do you want to count up to 100 but not to 101? To 200 > > > [snip good example] A person's age; you may not know where to put the limit, but you know you need to do additional checking if you see 200. > Angular measurements: 0..360 (though likely you'd want some > floating point type with an upper bound one "step" below 360.0) If I wanted all responses to be "normalized," I would override the operators to make it a "modular" float. But the point of strong typing is that you can't inadvertently add an Age to the measure of angle AGE. More important to me than strong typing is abstraction--the ability to define types whose properties match what they represent--instead of just being new names for 'int' or 'float' When these types are numeric in nature, Ada's deriving and subtyping mechanisms make this simple. In C/C++/Java you have to do a lot more work to get the same behavior. In Java, you CAN'T get the same behavior with reasonable syntax, since operators are banned from such types. -- Wes Groleau Alive and Well http://freepages.religions.rootsweb.com/~wgroleau/