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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7eaf9f2597de2259 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-08 10:12:13 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: on package naming, should the word "_pkg" be part of it? X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3BC1DB22.E127B53D@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: <9pif1o01btl@drn.newsguy.com> <3BBD12F1.9BED0B70@acm.org> <3BC0B1D4.21C79A8@acm.org> Mime-Version: 1.0 Date: Mon, 8 Oct 2001 16:58:10 GMT X-Mailer: Mozilla 4.5 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.google.com comp.lang.ada:13944 Date: 2001-10-08T16:58:10+00:00 List-Id: Stephen Leake wrote: > > I use _Type. The reason is that types and objects share the same > namespace, yet the most reasonable name for an object and a type is > the same: > > type Car is record ... end record; > > Car : Car; > > This is natural, but illegal. The easiest (for _me_, not for > everyone!) way to resolve it is to add some "noise" to either the > object or the type. Since the object name will appear more often than > the type, I add noise to the type: No, it's not natural. What might be natural is VIN_ABC1234567JKLK67 : Car; or Car : Chevy_1957; More realistically, Current_Vehicle : Car; Even this is incorrect. Current_Vehicle is not a car, it is a collection of information about a car: Current_Vehicle : Car_Info; The developer thinks, "This type is a collection of information about cars, so its name should be Collection_Of_Information_About_Cars, or Car_Info for short." Or something like that. Further, there is generally no problem with object names, since objects of the type are generally not declared in the same scope: Car : Car_Handler.Car; It is parameter names defined in the same scope that are perceived as a problem. In many cases, even parameter names are not a problem. When inserting into a list, Into seems a better parameter name than List; when iterating over a structure, Over seems better than List, Queue, or Stack, and so on. Maybe _Info is still noise, but it seems like more reasoned noise than _Type. If the object is simply to put some noise on the end of type names to distinguish them from parameter names, then _T seems as good as any other noise. Another "solution" I have seen is package Types is type Bicycle is ... type Car is ... type Number is ... type Rainfall_Sensor_Reading is ... ... end Types; with Types; package Functions is function Bicycle_Speed (Bicycle : Types.Bicycle) return Types.Number; function Car (Number : Types.Number) return Types.Car; function Car_Speed (Car : Types.Car) return Types.Number; ... end Functions; Never a name problem! Even noise is better than this. -- Jeffrey Carter