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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b19fa62fdce575f9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-01 14:57:16 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!gatech!paladin.american.edu!auvm!J64.STRATCOM.AF.MIL!BennettC Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU Newsgroups: comp.lang.ada Encoding: 54 TEXT X-Mailer: Microsoft Mail V3.0 Message-ID: <2EDE1E07@SMTPGATE2.STRATCOM.AF.MIL> Date: Thu, 1 Dec 1994 11:06:00 PST Sender: Ada programming language From: "Bennett, Chip (KTR) ~U" Subject: Re: Why don't large companies use Ada? Date: 1994-12-01T11:06:00-08:00 List-Id: ron house wrote: > How about "Ada - use it when you want to multiply a length by a length > and get a length, or when you want to be prevented from dividing an area > by a length because they have different types." > (PS: yes, you can fix that by defining zillions of additional *,/,- and + > functions, but good grief...) It seems to me that how many functions you have to define depends on how you approach the problem. Let's start with the premise that there are many triples of numbers that exhibit similar relationships. For example: 1) length, 2 (squared), area 2) length, 3 (cubed), volume 3) length, N, hyperspace :-) Or perhaps a different relationship: 1) speed, time, distance 2) principle, rate, interest 3) mass, acceleration, force 4) current, resistance, voltage 5) mass, (light speed) squared, energy 6) large unit of measure, constant, small unit of measure Now, we ought to be able to create a generic package that declares a set of allowable functions for a particular relationship (A := B * C, C := A / B, etc.). Then we could create a package that declares a set of private types (i.e. speed, time, and distance) and instantiates the generic package of math functions using the private types. Since the types are private they are limited to the functions in the instantiated generic. Area := Length ** 2 is allowed, but Length := Length ** 2 is not allowed. In Ada 83 there is a limitation in that we can't extend the set of allowable functions for some triple that has some _extra_ relationship that the others don't have, but child packages in Ada 9X would allow for adding new functions to the private type. Given that there is a fairly limited set of relationship groups for triples that make sense in the real world, I doubt you would have to write very many additional math functions. All that said, I've never actually tried this, but it seems plausible. Any thoughts? ***************************************************************** * Chip Bennett, GDE Systems Inc | BennettC@j64.stratcom.af.mil * * USSTRATCOM/J64213 | Voice (402)294-7360 * * 901 SAC Blvd, Suite 2B24 | FAX (402)294-7912 * * Offutt AFB, NE 68113-6600 | Proud member of Team Ada * * Opinions expressed here are my own _so_, TTFWTW * *****************************************************************