From: jankok@mcvax.uucp (Jan Kok)
Subject: Re: Exception handling question
Date: Mon, 13-Oct-86 07:21:39 EDT [thread overview]
Date: Mon Oct 13 07:21:39 1986
Message-ID: <313@zuring.mcvax.UUCP> (raw)
In-Reply-To: 2737@burdvax.UUCP
In article <2737@burdvax.UUCP> eric@burdvax.UUCP (Eric Marshall) writes:
> . . . The LRM paragraph says
>
> the raise statement with no exception name is only allowed in
> an exception handler, but not in the sequence of statements of
> a subprogram, ... enclosed by the handler.
>
>All of these additional constructs can only be introduced by
>a block statement. The paragraph never explicitly addresses the
>raising of the exception in the statements of the block, therefore
>it seems the posted program is indeed illegal.
I disagree: I think the original program is correct Ada (provided
that Textio is replaced by Text_Io of course). A raise statement
without an exception name is allowed, it is not a subprogram, package,
task or generic unit, to which the forbidding rule quoted applies.
To return to the posted program: it is not clear to me (but I may be
oversuspicious) whether the systems which cause printing "Missed it"
missed the first or the second exception handler, and I suggest to
insert an extra Put_Line to ascertain this. So my proposed
modification is:
with Text_Io; -- was Textio in original
procedure Foo is
Bar : exception;
begin
begin
begin
raise Bar;
exception -- Handler 1
when Bar =>
begin
Text_Io.Put_Line("Handler 1 got it");
raise;
exception -- Handler 2
when Bar =>
Text_Io.Put_Line("Handler 2 got it");
end;
end;
exception -- Handler 3
when Bar =>
Text_Io.Put_Line("Some handler missed it");
end;
end Foo;
--
Russell did not write that changing "raise;" into "raise Bar;"
corrected the performance for the failing compiler (did he?).
--
Mail: Jan Kok, CWI (afd. NW), Postbus 4079, NL-1009 AB Amsterdam, Nederland
UUCP: jankok@mcvax.uucp
---------------------------------------------------------------
One of the Warner Bros to Albert Einstein:
I have a theory about relatives myself : Don't hire them!
next prev parent reply other threads:[~1986-10-13 11:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1986-10-02 21:03 Exception handling question Russ Holden
1986-10-06 17:01 ` Eric Marshall
1986-10-07 19:40 ` John B. Goodenough
1986-10-09 13:38 ` Eric Marshall
1986-10-13 11:21 ` Jan Kok [this message]
1986-10-25 0:24 ` stt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox