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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, 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-12 22:00:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!logbridge.uoregon.edu!fr.usenet-edu.net!usenet-edu.net!enst.fr!not-for-mail From: "Grein, Christoph" Newsgroups: comp.lang.ada Subject: Re: Announce: The Ultimate SI Units Cracker Date: Fri, 13 Sep 2002 06:53:50 +0200 (MET DST) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1031893205 9044 137.194.161.2 (13 Sep 2002 05:00:05 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Fri, 13 Sep 2002 05:00:05 +0000 (UTC) Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: /iUjEOr5MOG1zJGBEtpQ6w== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk X-Reply-To: "Grein, Christoph" List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:28902 Date: 2002-09-13T06:53:50+02:00 From: Wes Groleau > > Since Ada has a 'special' meaning for attribute, perhaps > 'component' or 'discriminant' would be better. Perhaps 'component', but not 'discriminant', since only one variant really uses discriminants. I decided against component, because the type is private and you do not see components. I used attribute since the OO community likes to call what Ada does with components, instance attributes. > Anyway, looks nice. I once implemented a package with > the 'derived types' approach, and I agree that creating > all the operations is a pain. I had a generic for each operator, > but it was Ada 83, so the instantiations had to be in the spec, > making the spec over 4,000 lines long. Someone with a little > authority thought a 4,000 line spec was unacceptable, so he > rewrote it non-generic, reducing the spec down to "only" 3,000 > lines (and increasing the body from less than 50 to over 5,000). And what's most unsatisfactory is that despite all these overloadings, you cannot get function "**" (Base: SI_Unit; Exp: Rational) return SI_Unit; > I like the discriminant approach, but it does have another > disadvantage in that a lot of numeric operations are lost. > > You can't query 'First, 'Last, 'Small, etc. But maybe when > dealing with physical units those don't really matter much. > And of course the package can provide substitutes. > > You also can't provide such a type as a generic formal > where a float or fixed is expected. (Speaking of which, > perhaps a fixed-point version of SI would be useful to someone.) > > ... [text omitted] > > 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; Perhaps this could work only for a private type that is tagged. Would this be a proposal for Ada0Y? If so, we would need a convincing example for the ARG of a problem that can be solved with such a new feature that cannot be solved nicely without it...