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: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Naming of Tagged Types and Associated Packages Date: 1998/07/30 Message-ID: #1/1 X-Deja-AN: 376447743 References: <6pdhfo$1br$1@platane.wanadoo.fr> <6pi71p$n90$1@platane.wanadoo.fr> <6ppc3q$8ju$1@platane.wanadoo.fr> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada Date: 1998-07-30T00:00:00+00:00 List-Id: I said: > Ah, but I always find myself doing the following:... > > So both the use clause issue, and the meaningful name issue go away. In article <6ppc3q$8ju$1@platane.wanadoo.fr> "Jean-Pierre Rosen" writes: > I discussed the drawbacks of this approach in my paper > (http://perso.wanadoo.fr/adalog/naming9x.zip, now includes the ppt version > thanks Ted Dennison). > Basically: forces you to use empty extension aggregate. If the package > declares other stuff (like secondary types) you must reexport it manually. This is where we will have to leave it. I don't find adding "with null" offensive, and I usually do need to access secondary types, but the only sane way to do it is with a qualified names because there may be several types of that name (often the same one) in the derivation stack. A VERY simplified example: with Ada.Finalization; package People is type Person is tagged private; function Name(Who: in Person) return String; procedure Set_Name(Who: in out Person; Name: in String); function Address(Who: in Person) return String; function Set_Address(Who: in out Person; Address: in String); ... private package Add_Name is new Unbounded_String_Component( Ada.Finalization.Controlled); package Add_Address is new Unbounded_String_Component( Add_Name.Record_Type); type Person is new Add_Address.Record_Type with null; pragma Inline(Name, Set_Name, Address, Set_Address); end People; Now in the body I'll have to write things like: function Name(Who: in Person) return String is begin return Add_Name.Get(Who); end Name; I can't use a renaming as body, because Get takes a classwide parameter so I don't get driven crazy by adding conversions. Yes, you can use dispatching, but when you have twenty or so instantiations, it gets seriously confusing. why go to all the "trouble" required to build object classes like this? Because the operations required to display an object with dynamic updating and other niceties comes with the component packages. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...