From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed3-b.proxad.net!nnrp4-2.free.fr!not-for-mail Subject: Re: GtkAda : Trying to derive a widget Newsgroups: comp.lang.ada References: <606f5938$0$27421$426a74cc@news.free.fr> <606fe610$0$3717$426a74cc@news.free.fr> <60703d8c$0$6192$426a74cc@news.free.fr> From: DrPi <314@drpi.fr> Date: Fri, 9 Apr 2021 15:37:50 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Message-ID: <607058b0$0$6467$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 09 Apr 2021 15:37:52 CEST NNTP-Posting-Host: 82.65.30.55 X-Trace: 1617975472 news-1.free.fr 6467 82.65.30.55:56918 X-Complaints-To: abuse@proxad.net Xref: reader02.eternal-september.org comp.lang.ada:61768 List-Id: Le 09/04/2021 à 14:23, Dmitry A. Kazakov a écrit : > On 2021-04-09 13:42, DrPi wrote: >> Le 09/04/2021 à 08:18, Dmitry A. Kazakov a écrit : > >>> Debug_Panel belongs to both Debug_Panel_Record'Class and >>> Gtk_Scrolled_Window_Record'Class (and many other classes), so the >>> ambiguity. >>> >> Surprising behaviour for a strongly typed language but there surely is >> a good reason. > > It is strongly typed. > > The class is defined a set of types closed upon inheritance. When you > declare a class-wide operation like Initialize it is meant to work on > all instances of the class. There is no type violation or type coercion > here. > > Initialize of Gtk_Scrolled_Window_Record'Class is defined on > Gtk_Scrolled_Window_Record and all types derived from > Gtk_Scrolled_Window_Record. > > When you declare another Initialize on Debug_Panel_Record'Class it is > defined on Debug_Panel_Record and all its descendants. > > If you overload them, in a context you must disambiguate for > Debug_Panel_Record and any descendant of. > > This is not different from Ada subtypes. For example, you can declare > >   procedure Foo (I : Integer); > > and in some other package > >   procedure Foo (I : Positive); > > If both become visible in a context you would have same problem. > Ok. Thanks for clarifying.