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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,63a41ccea0fc803a X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Naming of Tagged Types and Associated Packages Date: 1998/09/06 Message-ID: #1/1 X-Deja-AN: 388352457 Sender: matt@mheaney.ni.net References: <6qfp80$p0u$1@nnrp1.dejanews.com> <35CD0A8E.21D64380@sprintmail.com> <35CEBAAF.B9B82820@sprintmail.com> <35F0CAF2.9B447FD2@sprintmail.com> NNTP-Posting-Date: Sun, 06 Sep 1998 00:41:24 PDT Newsgroups: comp.lang.ada Date: 1998-09-06T00:00:00+00:00 List-Id: "John G. Volan" writes: > Look, I provided you with one puzzle to solve, but you insist on solving > a different one, one that's easier for you to fit into your scheme. > Okay, fine, but how about solving my puzzle, too? What if -- what if > -- you were presented with a problem domain where there are cars, and > there are colors, and there are other things that can have colors, and > any car can get any of the colors? For me, if I were coding in Ada, it > would be simple: I don't accept your argument, because I don't accept your premise. I can only speak from my own experience. And from my own experience, color types, and speed types, and heading types, don't exist independently of higher level abstractions, like cars, and targets, and airframes, and ownships, etc. If you have a compelling need to declare an enumerated color type (say), for use by multiple abstractions, then go ahead and name it Color_Type: package Color_Types is type Color_Type is (...); end Color_Types; My philosophy is to use the name _Type only as a last resort, as it has a sort of generic quality to it. That sometimes turns out to be useful, as in the example above. Some guys name generic formal types _Type, for exactly that reason. But if I'm implementing a car abstraction that had a color attribute, then I would name the color type Car_Color. You point out a problem with this scheme, and that is if there are two color objects in the same scope. You correctly observed that my use of an abbreviation in that case wouldn't be necessary if I had used the name _Type.