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 Path: g2news2.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 06 Nov 2009 12:59:57 -0600 From: "Vincent Marciante" Newsgroups: comp.lang.ada References: <561e0a4a-c6c0-42db-9f31-a70f4eae1ed9@a21g2000yqc.googlegroups.com> Subject: Re: Types, packages & objects : the good old naming conventions question (without religious ware) Date: Fri, 6 Nov 2009 13:58:42 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Message-ID: X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 75.99.9.146 X-Trace: sv3-TP832RCFSWXeTLXGloeOcRtnTWLsxvExYZWYNr00iZ3tpi6vlu1WVWdLUlpCM1azLCKm/nk33vl2BPh!BR69/6kusTy888CPRv8Sc2LkuP7ZhxyR1kGqhZHXMgagHdkdFj1PcHirtnsmu9+hARY4cuJi17+L!cj4+FT3TBPC9OKZyJcHfA6QUAv0bCiA= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Xref: g2news2.google.com comp.lang.ada:9018 Date: 2009-11-06T13:58:42-05:00 List-Id: "Stephen Leake" wrote in message news:uskcsne3h.fsf@stephe-leake.org... > "Vincent Marciante" writes: > >> "Stephen Leake" wrote in message >> news:u1vkdrert.fsf@stephe-leake.org... >>> This is illegal: >>> >>> procedure (List : in list); >>> >>> So we have to add noise to either the object or the type, to keep the >>> compiler happy. That's all there is to it. >> >> That is not necessary: >> >> package sdgfkjasf is -- or whayever >> >> type List is ... >> >> procedure jsdfks (List : sdgfkjasf.List); >> >> ... > > That's the first time I've seen that suggestion. Or maybe you forgot! The following is part of a old discusion to which you contributed: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Newsgroups: comp.lang.ada From: "Vincent Marciante" Date: Fri, 5 Oct 2001 15:17:35 -0400 Local: Fri, Oct 5 2001 2:17 pm Subject: Re: on package naming, should the word "_pkg" be part of it? "Jeffrey Carter" wrote in message > John McCabe wrote: > > type Car_Type is > > record > > .... > > end record; > > procedure DoSomething (Car : in out Car_Type); > > could be replaced by: > > type Car is > > record > > .... > > end record; > > procedure DoSomething (The_Car : in out Car); > I recall reading articles about the psychology of understanding programs > (sorry, Robert Dewar, I don't have references for this, either. > Hopefully it's not just random neurons firing in my brain) that stated > that the first few characters of an identifier are the most important in > determining what you're reading. Having identifiers that are identical > for the first few characters requires more time and effort to > understand, and results in more errors in understanding. > Although both _Type and The_ are ways to resolve the type/parameter name > conflict, The_ is worse because it makes the first four characters of > every parameter name the same. > I make the type name reflect what the type contains. For example > type Car_Info ... > procedure P (Car : in Car_Info ... > This is not a popular approach, though, because it requires thought > about every type name. > -- > Jeffrey Carter What about the following: package XYZ is type Car ... procedure P (Car : in XYZ.Car ... -- Vinny <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > It's very interesting. The package name has to show up every time the type > is > paired with an object of the same name. But in other situations, the > package name can be left off. > > So this ends up being less noise than appending _Type everywhere. > > Just to be pedantic, it _is_ adding noise. It's just a different form > of noise than _Type. > > I'll have to try it in a semi-real project. I've been using _Type for > over 15 years, so it will take some effort :). > > It's interesting why no one seems to have thought of this before. In > general, the way to resolve ambiguities in Ada is to use more of the > full name. Somehow that never occured to me in this context. > > -- > -- Stephe