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-Thread: a07f3367d7,25d835bb9a4a003f X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Types, packages & objects : the good old naming conventions question (without religious ware) References: <561e0a4a-c6c0-42db-9f31-a70f4eae1ed9@a21g2000yqc.googlegroups.com> From: Stephen Leake Date: Sat, 31 Oct 2009 08:18:40 -0400 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (windows-nt) Cancel-Lock: sha1:L6J4DWW1SXHOvJj+Daw3kEBIFuE= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: c10c24aec2b1ae197caa725269 Xref: g2news2.google.com comp.lang.ada:8919 Date: 2009-10-31T08:18:40-04:00 List-Id: tmoran@acm.org writes: >> An example trap (to me at least) : what about a type which would seems >> obviously named Size and a parameter which seems obviously named >> Size ? X would surely not be OK, neither Item. > > There is no Size by itself - it's the Size of something. So a function > to calculate the price of a pumpkin, based on its size, would be > function Price(Pumpkin_Size : Size) return Dollars; You need 100,000 of these functions in a typical large grocery store. Ada doesn't support this: function Price(Pumpkin_Size : Size) return Dollars; function Price(Milk_Size : Size) return Dollars; function Price(Granny_Smith_Apple_Size : Size) return Dollars; Clearly this will be function Price (Item : Item_Type; Size : Size_Type) return Dollars; The context associates Size with Item; no need to add more noise. > function Price(Its_Size : Size) return Dollars; > That's as far as you can go if Size is the type name. If you used > something else, eg Size_Type or Size_T or Sizes, then you could > shorten the parameter name all the way to Size. Since you probably > write variable names much more often in the code than the type name, > it makes sense to try to shorten them, at the expense of slightly > longer type names. IMHO Exactly; that's why we use Size_Type. -- -- Stephe