comp.lang.ada
 help / color / mirror / Atom feed
From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: When is a rename not a rename?
Date: Sat, 2 Feb 2013 03:43:33 -0800 (PST)
Date: 2013-02-02T03:43:33-08:00	[thread overview]
Message-ID: <733da1ab-5b3a-4a24-a3d5-4c252d20a3c8@googlegroups.com> (raw)
In-Reply-To: <kehndk$1lt$1@dont-email.me>

On Saturday, February 2, 2013 1:42:29 AM UTC+1, Brian Drummond wrote:
> On Fri, 01 Feb 2013 09:32:42 -0800, Adam Beneschan wrote:
> The trick was something like renaming an object.method call to just 
> renamed_method.
>
> I forget the precise details but I recall it was legal; taking its access 
> was not (though astonishingly, it worked in current Gnat revisions)

See
http://en.wikibooks.org/wiki/Ada_Programming/Subprograms#Renaming

package Some_Package is
  type Message_Type is tagged null record;
  procedure Print (Message: in Message_Type);
end Some_Package; 

with Some_Package;
procedure Main is
  Message: Some_Package.Message_Type;
  procedure Print renames Message.Print;  -- this has convention intrinsic, see RM 6.3.1(10.1/2)
  Method_Ref: access procedure := Print'Access;  -- thus taking 'Access should be illegal; GNAT GPL 2012 allows this
begin  -- All these calls are equivalent:
  Some_Package.Print (Message);  -- traditional call without use clause
  Message.Print;                 -- Ada 2005 method.object call - note: no use clause necessary
  Print;                         -- Message.Print is a parameterless procedure and can be renamed as such
  Method_Ref.all;                -- GNAT GPL 2012 allows illegal call via an access to the renamed procedure Print
                                 -- This has been corrected in the current version (as of Nov 22, 2012)
end Main;



  reply	other threads:[~2013-02-02 11:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29  1:24 When is a rename not a rename? Adam Beneschan
2013-01-30  0:28 ` Randy Brukardt
2013-01-30  0:52   ` Adam Beneschan
2013-01-30  9:31     ` Dmitry A. Kazakov
2013-01-30 14:35       ` ytomino
2013-02-01 10:44 ` Ada novice
2013-02-01 11:27   ` Dmitry A. Kazakov
2013-02-01 17:32     ` Adam Beneschan
2013-02-01 18:31       ` ytomino
2013-02-02  1:40         ` Adam Beneschan
2013-02-02 12:24           ` ytomino
2013-02-02 14:26           ` Robert A Duff
2013-02-02 17:11             ` Shark8
2013-02-02  0:42       ` Brian Drummond
2013-02-02 11:43         ` AdaMagica [this message]
2013-02-03 11:50           ` Brian Drummond
2013-02-03 12:16             ` AdaMagica
2013-02-05  9:53       ` Ada novice
2013-02-01 17:48     ` Ada novice
replies disabled

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