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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,26a21b9e317dc639 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.224.173.202 with SMTP id q10mr2157943qaz.3.1353454995680; Tue, 20 Nov 2012 15:43:15 -0800 (PST) Received: by 10.49.6.36 with SMTP id x4mr3806503qex.30.1353454995649; Tue, 20 Nov 2012 15:43:15 -0800 (PST) Path: gf5ni2982588qab.0!nntp.google.com!i9no1395416qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 20 Nov 2012 15:43:15 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=68.4.246.214; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ NNTP-Posting-Host: 68.4.246.214 References: <9b0bcb37-8ae3-440f-af4f-a796702e4250@googlegroups.com> <114a6fcf-32c3-408f-961f-2e3bf3c5af04@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <87af1bfd-41d2-45c7-953a-c1954d4f5ceb@googlegroups.com> Subject: Re: Access type to member procedure of instance (Object Oriented programming in Ada) From: Adam Beneschan Injection-Date: Tue, 20 Nov 2012 23:43:15 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-11-20T15:43:15-08:00 List-Id: On Tuesday, November 20, 2012 1:38:38 PM UTC-8, Randy Brukardt wrote: > "Adam Beneschan" wrote in message=20 >=20 > >If Message had type Message_Type'Class, I'd assume that at some point, > >Message.Print'Access would need to determine which Print subprogram woul= d=20 > >be > >called, and figure out the address of it. I don't think it matters whet= her=20 > >it's done when the > >'Access value is computed or when the call is made, since the tag of an= =20 > >object can't be > >changed during the object's lifetime. I could be wrong, though; maybe I= 've=20 > >missed a case > >where it matters. (But I'm not concerned about the possibility of an=20 > >object's tag being > >changed through extralegal means like Unchecked_Conversion.) >=20 > I don't think this is quite true; if the object is a parameter (for=20 > instance), it can have different tags for different calls. But I don't se= e=20 > that happening for something like Param.Print'Access -- access values are= =20 > never dispatching. >=20 > Anyway, since something like Param.Print'Access is illegal in any case, w= e=20 > don't have to decide what this means or how code would be generated for i= t. 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 bo= th 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 comp= ile 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 wa= s dereferenced in order to call the subprogram, since the object's tag shou= ldn'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