From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: GtkAda : Trying to derive a widget
Date: Fri, 9 Apr 2021 14:23:56 +0200 [thread overview]
Message-ID: <s4ph0q$u8e$1@gioia.aioe.org> (raw)
In-Reply-To: 60703d8c$0$6192$426a74cc@news.free.fr
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
next prev parent reply other threads:[~2021-04-09 12:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 19:27 GtkAda : Trying to derive a widget DrPi
2021-04-08 22:27 ` Dmitry A. Kazakov
2021-04-09 5:28 ` DrPi
2021-04-09 6:12 ` J-P. Rosen
2021-04-09 11:32 ` DrPi
2021-04-09 6:18 ` Dmitry A. Kazakov
2021-04-09 11:42 ` DrPi
2021-04-09 12:23 ` Dmitry A. Kazakov [this message]
2021-04-09 13:37 ` DrPi
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox