From: mcsun!fuug!prime!mits!rkaivola@uunet.uu.net (Risto Kaivola)
Subject: Re: Elaboration and parameters
Date: 29 Jun 93 23:20:41 GMT [thread overview]
Message-ID: <rkaivola.741396041@mits> (raw)
Several people have pointed out that the original program is
no good for illuminating the issue because it won't be capable
of being bound. The reason that the example turned out incorrect
is that I had actually a longish, working sample program, and
decided to strip it down a bit, and didn't bother to check the
new version even by compiling it. Yes, I should have known better,
but I though it obvious it would work :-). Nevertheless, you all
understood my intent correctly. In case someone is interested, here
is the original example program, which should be correct apart from
possible types made in keying it in for this post.
-------------------- [sample program] --------------------
--- Compilation unit 1 ---
package P1 is
MY_EXCEPTION : exception;
subtype S is INTEGER range 0 .. 1;
function EXCEPT(ARG : S) return S;
end P1;
--- Compilation unit 2 ---
package body P1 is
function EXCEPT(ARG : S) return S is
begin
raise MY_EXCEPTION;
return S(0);
end EXCEPT;
end P1;
--- Compilation unit 3 ---
with P1;
package P2 is
procedure PROC(ARG : P1.S);
end P2;
--- Compilation unit 4 ---
package body P2 is
procedure PROC(ARG : P1.S) is
begin
null;
end PROC;
end P2;
--- Compilation unit 5 ---
with TEXT_IO; use TEXT_IO;
with P1, P2;
pragma ELABORATE(P1);
-- Note: no ELABORATE pragma for P2.
procedure MY_MAIN is
OBJ : P1.S := 0;
begin
P2.PROC(P1.EXCEPT(OBJ));
-- What happens here if the body of P2 has not yet been elaborated?
exception
when PROGRAM_ERROR =>
PUT("NE");
when P1.MY_EXCEPTION =>
PUT("E");
end MY_MAIN;
----------------- [end of program] -----------------
But anyway, if one of the exception handlers of the procedure MY_MAIN is
executed, the consensus seems to be that it is implementation dependent
whether NE or E is put, or are you of a different opinion?
--
Risto Kaivola
(Internet address: rkaivola@mits.mdata.fi)
next reply other threads:[~1993-06-29 23:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-06-29 23:20 Risto Kaivola [this message]
-- strict thread matches above, loose matches on Subject: below --
1993-07-04 16:49 Elaboration and parameters Simon Wright
1993-07-02 7:00 Richard A. O'Keefe
1993-06-29 21:06 Gene Ouye
1993-06-29 19:51 cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!noc.near.ne
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox