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.mixmin.net!aioe.org!5WHqCw2XxjHb2npjM9GYbw.user.gioia.aioe.org.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: GtkAda : Trying to derive a widget Date: Fri, 9 Apr 2021 14:23:56 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <606f5938$0$27421$426a74cc@news.free.fr> <606fe610$0$3717$426a74cc@news.free.fr> <60703d8c$0$6192$426a74cc@news.free.fr> NNTP-Posting-Host: 5WHqCw2XxjHb2npjM9GYbw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader02.eternal-september.org comp.lang.ada:61767 List-Id: 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. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de