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-08 09:11:01 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!ix.netcom.com!netcomsv!butch!rapnet.sanders.lockheed.com!rapnet.sanders.lockheed.com!gamache From: gamache@rapnet.sanders.lockheed.com Newsgroups: comp.lang.ada Subject: Re: Why don't large companies use Ada? Date: 8 Dec 94 09:27:43 -500 Organization: Lockheed Sanders, Inc. Message-ID: <1994Dec8.092743.1@rapnet.sanders.lockheed.com> References: <3bj07h$qus@felix.seas.gwu.edu> <3blc1s$8gr@network.ucsd.edu> <3btf4n$jma@felix.seas.gwu.edu> NNTP-Posting-Host: dune.sanders.lockheed.com Date: 1994-12-08T09:27:43-05:00 List-Id: In article <3btf4n$jma@felix.seas.gwu.edu>, mfeldman@seas.gwu.edu (Michael Feldman) writes: > In article <3blc1s$8gr@network.ucsd.edu>, > Matt Kennel wrote: > [snip] >> >>What system of lengths/time/masses? > > Could be adapted to MKS, CGS, or both, with conversion constants. > It's really intended to show the technique, not to be exhaustive. >> [more snip] > BTW - the variant-record solution is not at all original with me; > it's been sketched out several times in the literature. I take credit > only for boiling it down and making a pretty complete package out of > it, so that it shows how to handle dimensions and also how Ada does > safe variant records. > > Your "nondimensional" variables are fine, and in Ada would be done, > presumably, by just creating a bunch of nicknames for Float (say): > > SUBTYPE Length IS Float; > SUBTYPE Mass IS Float; > > etc. I have no problem with this approach. Recall that the thread > started with a guy who said Ada's type system gets in the way of > declaring _new_ or _derived_ types to handle units, e.g. > > TYPE Length IS DIGITS 6; > TYPE Mass iS DIGITS 6; > This seemingly innocuous example hits one of my hot buttons. [climb soapbox] So much damage can be done with a bad example it never ceases to amaze me. (ok, so this is why I'd rather mostly read CLA than post...!) I've always thought that K&R did so much harm to this profession with the examples it contained. I don't know about anyone else, but I still see people who think it is acceptable to name file pointers "fp". How does this relate to the above? Well, I always view user defined types as not only a way to provide contraints, but also as a means to provide *information* to some future reader of the code (which could possibly even be the author his/her self). This example, which *some* people will think is an okay way to code fails to capitalize on this opportunity to convey some information. For instance, object definitions might look like: Obj1_Mass : Mass := 0.001; Obj2_Mass : Mass := 3.5; the type definition fails to provide readers with any useful information. This is particularly noticable when people use _type on type definitions. Then you frequently see: Mass : Mass_Type; Few such simple issues get to me as much. I even wish compilers would disallow this construct altogther. What would a future reader like to know? Is mass in kilograms, grams, milligrams? Is length feet, meters, miles? Code could then look like: Obj1_Mass : Grams := 0.001; which conveys much different information than: Obj2_Mass : Kilograms := 0.001; IMO, the distinction between this and the above is important. Unfortunately, too much code that I see uses types such as length, mass etc. [ok, climb down from soapbox...] ------------------------------------------------------------------------------- Joe Gamache Lockheed Sanders Inc. with all_disclaimers_standard_or_otherwise; _______ ______ / | | / ___ / | | | ___| / \ |\ /| / \ | \ / \ -- -- | | / / \ | \ / | / / \ | |\ \ / / \ | | | -- / / \ \ | \ | / / \ \ | | \ | / / \ \ | | | -- | --- | | \ / | | --- | | | / / | --- | | | | | | --- | | |\| | | --- | | |/ / | --- | | | | ---| | | | | | | | | | | | | | / | | | | |_| |____| |_| |_| |_| |_| |_| |_| |_/ |_| |_|