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: "Jean-Pierre Rosen" Subject: Re: Naming of Tagged Types and Associated Packages Date: 1998/07/25 Message-ID: <6pdhfo$1br$1@platane.wanadoo.fr>#1/1 X-Deja-AN: 374893694 Content-Transfer-Encoding: 7bit References: Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Adalog Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-07-25T00:00:00+00:00 List-Id: >And whatever you do, please do NOT name a type "Object" or "Instance". >This is a sure sign of confusion about the difference between a module >and a type, which are orthogonal language features in Ada. > Well, since I was the first one to publish that notation (I do not claim to be the first one who thought of it), let me follow up. We are talking about classes here, and a class is an encapsulation of a data type together with operations. In that sense, a type is certainly not a class, since it addresses only the data-type part of a class. Rather, a class is a certain way of using a package, to declare a type and associated operations (methods), and nothing else. Of course, there are other ways of using packages: packages, as well as types and nearly any other feature of the language, are building blocks that allow you to create various paradigms depending on the way you put them together. However, if you agree that such a package corresponds to what is called a class in OO languages, then it makes sense to name the package, not the type, after the entity you want to represent. Now the package may declare some utility types in addition to the "main" type; it makes sense to have some notation to distinguish this main type. "Instance" or "Object" look nice in a declaration like: My_Account: Bank_Account.Instance; but this is not the main point. The really important point is to use the same name for the main type of every "class package", because it allows you to have a uniform convention, whether you're using a declared package or an instantiation of a generic. And remember that generic are very important, since they provide multiple inheritance (or to be more politically correct: because they fulfill the needs that are fulfilled by multiple inheritance in other languages ;-) A full discussion of these issues can be found in the paper "a naming convention for classes in Ada 9X" which appeared in Ada Letters by the end of 94 (sorry, I don't have the exact reference at hand).