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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Type naming conventions: Any_Foo Date: Fri, 6 Dec 2019 18:57:19 -0600 Organization: JSA Research & Innovation Message-ID: References: Injection-Date: Sat, 7 Dec 2019 00:57:19 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="2934"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader01.eternal-september.org comp.lang.ada:57680 Date: 2019-12-06T18:57:19-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:qsee2v$par$1@gioia.aioe.org... > On 2019-12-06 21:18, Jeffrey R. Carter wrote: >> On 12/5/19 10:51 PM, Dmitry A. Kazakov wrote: >>> >>> Ada standard library uses _Type, e.g. >>> >>> generic >>> type Element_Type (<>) is private; >>> with function "=" (Left, Right : Element_Type) return Boolean is <>; >>> package Ada.Containers.Indefinite_Holders >> >> Yes, and the ARM also includes such abominations as anonymous access >> types. Just because it's in the ARM doesn't mean it's the best way to do >> something. Element is be a better name for that formal type. > > No, it would be misleading. Element must be reserved for instances of the > type. They are actual elements. The type of an element is not an element, > these are two totally different things. Agreed. Ada.Containers all have a function Element that retrieves a (copy of) a single element object from the container. If the type was named element, what would this function be called? Similarly, some of the parameters are called Element (thus, Element : Element_Type in many parameter lists); those also would need alternate names. There were a number of ARG members that disliked the "_Type" notation, so we looked at alternatives. And we didn't find anything that worked as well. Sometimes, package design is about the "least bad" alternative. Randy. >>> There are lots of cases in Ada, you certainly should know that. As a >>> practical example GtkAda declares all widget types twice: >>> >>> type Gtk_Button_Record is ... >>> type Gtk_Button is access all Gtk_Button_Record'Class; >> >> No well designed library has public access types. You aren't required to >> use a library that does, and you aren't required to use access types. > > I am required to. There must be always be two types in a GUI, one > referential type and one implementation type. The widget implementation > object in GtkAda is Gtk_Button_Record. The widget referential object is > Gtk_Button. It could be a handle or a smart pointer type instead of plain > pointer, but there is no way to reduce it to a single type. So the problem > will persist. > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de