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,2afac1a4161c7f35 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Distinguishing type names from other identifiers Date: 1998/01/25 Message-ID: #1/1 X-Deja-AN: 319139275 Content-Transfer-Encoding: 8bit References: <199801121523.QAA06527@basement.replay.com> <01bd2078$a449b460$41fd82c1@xhv46.dial.pipex.com> <6v0LMGAjwIw0Ews0@dowie-cs.demon.co.uk> Mime-Version: 1.0 Distribution: world Content-Type: text/plain; charset=ISO-8859-1 Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1998-01-25T00:00:00+00:00 List-Id: In article <6v0LMGAjwIw0Ews0@dowie-cs.demon.co.uk>, Martin M Dowie wrote: >...how do people feel about prefixing types with 'A_' or 'An_'? the >theory is that should you wish a function to return something of this >type you just 'A_/An_'. It also reads a little more english-like than >'_type'/'_t', although i've never really thought that 'for this_index in >a_something loop' etc. was particularly like any english i've ever >heard... > >it kind of ties in with an OO-mentality too, as (talking Ada83 here) we >are using types to build classes, and data objects for >objects/instances. having a general name for a type helps get this over. Be consistant with the style used in the RM. If you ever have a question about how to name something, then flip through the RM (or ask me :-) to see how the RM does it, and name it that way. Don't make up a convention because you think it's more "oo-like." So the answer is: No, do not use the indefinate article to name types or objects. That convention does not appear in the RM, so its use in your code would be inconsistant with the RM. The reason we Ada programmers even have this debate about the _Type convention, is because the file type in Text_IO was named File_Type. Had the designers named it Text_File, which is how the abstraction is described in the Rationale (see Text Files, Section 16.5; see also Indexed and Sequential Files, section 16.4), we wouldn't be having this debate at all, and very likely it wouldn't have even occurred to anyone to use _Type for type names. This is the argument against _Type as a suffix. Because it's a noise word, it doesn't add any new information. If you have to type something, then you might as well type something that adds meaning. I would have prefered that the I/O types been named Text_File instead of Text_IO.File_Type Indexed_File instead of Direct_IO.File_Type Sequential_File instead of Sequential_IO.File_Type This convention exactly corresponds to the description in the Rationale. -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271