comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Access type to member procedure of instance (Object Oriented programming in Ada)
Date: Tue, 20 Nov 2012 15:43:15 -0800 (PST)
Date: 2012-11-20T15:43:15-08:00	[thread overview]
Message-ID: <87af1bfd-41d2-45c7-953a-c1954d4f5ceb@googlegroups.com> (raw)
In-Reply-To: <k8gt8u$a2a$1@munin.nbi.dk>

On Tuesday, November 20, 2012 1:38:38 PM UTC-8, Randy Brukardt wrote:
> "Adam Beneschan" wrote in message 
> 
> >If Message had type Message_Type'Class, I'd assume that at some point,
> >Message.Print'Access would need to determine which Print subprogram would 
> >be
> >called, and figure out the address of it.  I don't think it matters whether 
> >it's done when the
> >'Access value is computed or when the call is made, since the tag of an 
> >object can't be
> >changed during the object's lifetime.  I could be wrong, though; maybe I've 
> >missed a case
> >where it matters.  (But I'm not concerned about the possibility of an 
> >object's tag being
> >changed through extralegal means like Unchecked_Conversion.)
> 
> I don't think this is quite true; if the object is a parameter (for 
> instance), it can have different tags for different calls. But I don't see 
> that happening for something like Param.Print'Access -- access values are 
> never dispatching.
> 
> Anyway, since something like Param.Print'Access is illegal in any case, we 
> don't have to decide what this means or how code would be generated for it.

I probably confused things.  Yes, Param.Print'Access is illegal, but I was thinking in terms of "what if" we added a language feature to make it legal--probably by adding a new kind of access type that contained references both to the prefix object and, somehow, to the subprogram.  In that case, I'd want it to be dispatching, if Param's type were classwide.

This would mean that if Param's type were classwide, the actual subprogram referred to by the access value would be determined at runtime, not at compile time.  And I don't think it would matter *when* the subprogram address to which the program will dispatch were actually determined, i.e. when the statement containing the 'Access were executed, or when the access value was dereferenced in order to call the subprogram, since the object's tag shouldn't change in between those times.

But I guess I didn't make it clear that all this was ***if*** we decided to add a new capability to the language and if we did it the way I envision.  Sorry about that.  Hope this helps clear things up.

                                -- Adam




  reply	other threads:[~2012-11-20 23:43 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
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 [this message]
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