comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Access type to member procedure of instance (Object Oriented programming in Ada)
Date: Mon, 19 Nov 2012 22:56:06 +0100
Date: 2012-11-19T22:56:06+01:00	[thread overview]
Message-ID: <1rmgkwpxhl86b$.wcpirg4sgwbv.dlg@40tude.net> (raw)
In-Reply-To: 6e3f6f2d-d221-4795-9c01-9abb013442b7@googlegroups.com

On Mon, 19 Nov 2012 12:52:17 -0800 (PST), ake.ragnar.dahlgren@gmail.com
wrote:

> Also it is possible to see that the callbacks are declared in the
> Simple_Callbacks package. Note that the methods are not instance member
> methods.

GtkAda package Gtk.Handlers provides generic package User_Callback which
does all you need. It is the recommended way to pass additional parameters
to Gtk event handlers. GValue objects could be used to pass more than one
parameter etc.
 
> I hope I am wrong but it seems to me that since Ada lacks the ability to
> create pointers (maybe access types are the right words) to instance
> member methods, it is not possible to take advantage of Ada's OOP features
> when developing Glade3 applications.

I doubt that this would be useful with Gtk anyway. Closures would require
special treatment in order to marshal them to Gtk handlers. There is a
complex infrastructure in Gtk for dealing with closures. It is based on
plain pointers. If Ada provided fat pointers (access types) for
object+primitive operation closures these would be incompatible with Gtk
closures anyway. And you would get accessibility checks failed most of the
time. Closures themselves is a huge problem when refer to dynamic objects.
You should not pass any objects this way which are not reference-counted by
the means of gobject. If you do Ada objects you should really be sure that
the object is not destructed before handler is called.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2012-11-19 21:56 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19  9:59 Access type to member procedure of instance (Object Oriented programming in Ada) ake.ragnar.dahlgren
2012-11-19 11:13 ` Georg Bauhaus
2012-11-19 11:39 ` Brian Drummond
2012-11-20 11:43   ` Brian Drummond
2012-11-20 21:57     ` Randy Brukardt
2012-11-19 13:03 ` sbelmont700
2012-11-19 16:18 ` Adam Beneschan
2012-11-19 17:02   ` Peter C. Chapin
2012-11-19 18:23     ` Adam Beneschan
2012-11-19 20:57       ` Peter C. Chapin
2012-11-19 21:26       ` Dmitry A. Kazakov
2012-11-19 22:19         ` Adam Beneschan
2012-11-20 10:12           ` Dmitry A. Kazakov
2012-11-20 21:51             ` Randy Brukardt
2012-11-21  8:24               ` Dmitry A. Kazakov
2012-11-21 22:19                 ` Randy Brukardt
2012-11-20 10:59     ` Brian Drummond
2012-11-19 20:22 ` ake.ragnar.dahlgren
2012-11-20 11:16   ` Brian Drummond
2012-11-19 20:52 ` ake.ragnar.dahlgren
2012-11-19 21:56   ` Dmitry A. Kazakov [this message]
2012-11-22  9:49     ` ake.ragnar.dahlgren
2012-11-19 22:13   ` sbelmont700
2012-11-19 23:59 ` Randy Brukardt
2012-11-20  0:05   ` Randy Brukardt
2012-11-20  1:00     ` Adam Beneschan
2012-11-20 21:38       ` Randy Brukardt
2012-11-20 23:43         ` Adam Beneschan
2012-11-21 22:12           ` Randy Brukardt
2012-11-22  1:59             ` Adam Beneschan
2012-11-29  2:43               ` Randy Brukardt
2012-11-20  0:52   ` Adam Beneschan
2012-11-20 21:34     ` Randy Brukardt
2012-11-20 11:28   ` Brian Drummond
2012-11-20 14:27     ` Georg Bauhaus
2012-11-20 15:52     ` Adam Beneschan
2012-11-22  9:47 ` ake.ragnar.dahlgren
2012-11-22 10:25   ` Dmitry A. Kazakov
2012-12-02 20:42     ` ake.ragnar.dahlgren
2012-12-03 11:21       ` Dmitry A. Kazakov
2012-12-03 20:21         ` ake.ragnar.dahlgren
2012-12-03 22:15           ` Dmitry A. Kazakov
2012-12-25 21:51           ` Gustaf Thorslund
2012-12-26 18:11             ` ake.ragnar.dahlgren
2012-11-22 12:13   ` Brian Drummond
2012-12-03 16:17     ` ake.ragnar.dahlgren
2012-12-03 21:56       ` Brian Drummond
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox