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,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7e60c1d99ae3ffa1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-13 08:42:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!newsfeed.mathworks.com!cyclone.swbell.net!bos-service1.ext.raytheon.com!dfw-service2.ext.raytheon.com.POSTED!not-for-mail Message-ID: <3D820736.180E7286@despammed.com> From: Wes Groleau Reply-To: wesgroleau@despammed.com X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en,es-MX,es,pt,fr-CA,fr MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Announce: The Ultimate SI Units Cracker References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 13 Sep 2002 10:41:42 -0500 NNTP-Posting-Host: 151.168.144.162 X-Complaints-To: news@ext.ray.com X-Trace: dfw-service2.ext.raytheon.com 1031931747 151.168.144.162 (Fri, 13 Sep 2002 10:42:27 CDT) NNTP-Posting-Date: Fri, 13 Sep 2002 10:42:27 CDT Organization: Raytheon Company Xref: archiver1.google.com comp.lang.ada:28937 Date: 2002-09-13T10:41:42-05:00 List-Id: > > What I'm getting at is the ability to define a private type > > so that it has all the attributes and operations of a numeric > > type and can be use as a generic parameter to a numeric package. > > That would be really cool, perhaps with some Ada0Y features... > But then it's not clear what e.g. a generic should do with the non-numeric > components. It could just ignore them. But then how should a function know what > to return if the actual for the formal T is SI_Unit? > > generic > type T is digits <>; > function F (X, Y: T) return T; This means that the generic body can expect T to have all the operations that any floating point type has. It can not expect it to have any operations that are not common to all floating point types. The function would have to return whatever the generic actual is. And it can only get that by operations that are inherited or overridden from Float or that it defines by using such operations. MAYBE .... type Clever is private digits 9; private type Clever is .... end; Require the body to define ALL operations that would be available for a true floating point type. I know this is difficult--that's probably why Java chose to have its dichotomy between primitive types that are actually numbers, and object-oriented types which, no matter how hard you try, you _can't_ treat completely as numbers. Or can you? If some Java files have class myInteger extends Integer { .... } and myInteger WeeksInYear = new myInteger ( 52 ); myInteger DaysInWeek = new myInteger ( 7 ); does Java allow methods to be defined to support myInteger DaysInYear = WeeksInYear * DaysInWeek + 1; -- Wes Groleau http://freepages.rootsweb.com/~wgroleau