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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,26a21b9e317dc639 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.74.72 with SMTP id r8mr3228694pav.32.1353362170452; Mon, 19 Nov 2012 13:56:10 -0800 (PST) Path: 6ni95789pbd.1!nntp.google.com!news.glorb.com!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Access type to member procedure of instance (Object Oriented programming in Ada) Date: Mon, 19 Nov 2012 22:56:06 +0100 Organization: cbb software GmbH Message-ID: <1rmgkwpxhl86b$.wcpirg4sgwbv.dlg@40tude.net> References: <9b0bcb37-8ae3-440f-af4f-a796702e4250@googlegroups.com> <6e3f6f2d-d221-4795-9c01-9abb013442b7@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: kWJV5lTRAyCzy8lsfOrlcw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-11-19T22:56:06+01:00 List-Id: 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