comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: When is a rename not a rename?
Date: Fri, 1 Feb 2013 12:27:02 +0100
Date: 2013-02-01T12:27:02+01:00	[thread overview]
Message-ID: <coikrsq8nv3b$.1xcqe2olg7bpv$.dlg@40tude.net> (raw)
In-Reply-To: f4d3708d-d17c-4e53-8f45-f9ac6f64ee54@googlegroups.com

On Fri, 1 Feb 2013 02:44:21 -0800 (PST), Ada novice wrote:

> If you have a minimal example that is proving the contrary, please post it here.

Here is how renaming is not renaming:

with Ada.IO_Exceptions;
procedure Test is
   package P is
      End_Error : exception renames Ada.IO_Exceptions.End_Error;
   end P;
   use P, Ada.IO_Exceptions;
begin
   null;
exception
   when End_Error => -- Compile error, should be none
      null;
end Test;

This is "diamond diagram" constructed using renaming:

procedure Test is
   package P is
      I : Integer;
   end P;
   package Q is
      J : Integer renames P.I;
   end Q;
   package R is
      J : Integer renames P.I;
   end R;
   use Q, R;
   X : Integer := J; -- Compile error, should be none
begin
   null;
end Test;

[Diamond diagram is common-place bogus argument against MI]

Yet another example when rename is something totally broken:

with Ada.Text_IO; use Ada.Text_IO;
procedure Test is
   X : Integer;
   Y : Positive renames X;
begin
   Y := -1;
   Put_Line ("And today positive number is " & Integer'Image (Y));
end Test;

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



  reply	other threads:[~2013-02-01 11:27 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 [this message]
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
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