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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e55245590c829bef X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!usenet-fr.net!gegeweb.org!aioe.org!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: _Type vs no _Type Date: Wed, 03 Nov 2010 22:16:07 +0100 Organization: Ada @ Home Message-ID: References: <86wroy58ff.fsf@gareth.avalon.lan> <86pqup5xfy.fsf@gareth.avalon.lan> <86y69d3rec.fsf@gareth.avalon.lan> <82lj5c5ecm.fsf@stephe-leake.org> <82zktq4n9b.fsf_-_@stephe-leake.org> NNTP-Posting-Host: 4vQNEkQz8jPZLol/IaLwBQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.63 (Win32) Xref: g2news2.google.com comp.lang.ada:16154 Date: 2010-11-03T22:16:07+01:00 List-Id: Le Wed, 03 Nov 2010 13:14:56 +0100, Stephen Leake = a =C3=A9crit: > The third choice is: > > package RPG is > > type Weapon is (Broadsword, Catapult, Torpedo); > procedure Attack (Weapon : RPG.Weapon); > > end RPG; Which is the choice giving it a name-space ;) Exactly what we do not hav= e. But what is a name space it this is not a way separate names ? Foo in on= e = name-space is not necessarily the same as Foo in another name-space. And= = what do C authors with C which does really have name-space ? They use = prefixes and suffixes. Name space is precisely a way to manage it : the = = prefix may vary, may be omitted (from within the name-space or after = renaming). > That was not introduced until after the two camps were firmly > established. I actually think this third choice is more in the spirit = of > Ada than either of the other two. I agree, but think of the two other camps : the one Use and the one of = no-Use. (lol, let's go to the funfair now) > Consistent conventions are _far_ more important than any reasons > supporting _type vs no _type. Yes! And Yes again! That is precisely consistency. And you you have to u= se = tricky names, there is no more consistency. I like a lot your third way, but this is not a peace of cake of cake if = = the package name is long. Luckily, a package can rename itself (I know n= o = objection for that in the RM and the compiler accept it). So, the version could be : with Ada.Text_IO; -- Game: guess what is wrong with that program. procedure Test is package Any_Package is type Foo is private; procedure Play_The_Foo_With_Me (Foo : Any_Package.Foo); private Type Foo is new Integer; end Any_Package; package body Any_Package is package Output renames Ada.Text_IO; package Integer_Output is new Output.Integer_IO (Any_Package.Foo); procedure Play_The_Foo_With_Me (Foo : Any_Package.Foo) is begin Output.Put ("I've played the FooL "); Integer_Output.Put (Item =3D> Foo, Width =3D> 0, -- Minimize width Base =3D> 10); Output.Put_Line (" times on you."); end; end Any_Package; Foo : Any_Package.Foo; begin Any_Package.Play_The_Foo_With_Me (Foo); end Test; Now, using a renaming of Any_Package inside of itself : with Ada.Text_IO; -- Game: guess what is wrong with that program. procedure Test is package Any_Package is package Types renames Any_Package; type Foo is private; procedure Play_The_Foo_With_Me (Foo : Types.Foo); private Type Foo is new Integer; end Any_Package; package body Any_Package is package Output renames Ada.Text_IO; package Integer_Output is new Output.Integer_IO (Types.Foo); procedure Play_The_Foo_With_Me (Foo : Types.Foo) is begin Output.Put ("I've played the FooL "); Integer_Output.Put (Item =3D> Foo, Width =3D> 0, -- Minimize width Base =3D> 10); Output.Put_Line (" times on you."); end; end Any_Package; Foo : Any_Package.Types.Foo; -- Or simply =E2=80=9CFoo: Any_Package.Types.Foo;=E2=80=9D begin Any_Package.Play_The_Foo_With_Me (Foo); end Test; If the convention of using =E2=80=9Cpackage Types renames Any_Package;=E2= =80=9D is = consistent enough, this may indeed be an option. Lot of thanks for your Idea Stephen (will have it mind in the future). -- = Si les chats miaulent et font autant de vocalises bizarres, c=E2=80=99es= t pas pour = les chiens.