comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Problem with Delay Alternative in Finalization
Date: Sat, 19 May 2012 16:31:59 -0400
Date: 2012-05-19T16:31:59-04:00	[thread overview]
Message-ID: <wccipfrvrnk.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 6v0er7d545kvs3pr7aqe1dnrlq4mg5ldhg@4ax.com

Tim McGuire <mcguire_tm2@yahoo.com> writes:

> Procedure Token_Test is
> begin
>   declare
>     Token : Test_Lock_Token.Lock_Token;
>   begin
>     Ada.Text_Io.Put_Line ("Got Token");
>     declare
>       Token_2 : Test_Lock_Token.Lock_Token;
>     begin
>       Ada.Text_Io.Put_Line ("Got Token_2");
>     exception
>       When Errors : Test_Lock_Token.Lock_Timeout_Exception =>
>         Ada.Text_Io.Put_Line ("Token_2 timed out!");
>     end;
>   exception
>     When Errors : Test_Lock_Token.Lock_Timeout_Exception =>
>       Ada.Text_Io.Put_Line("Token timed out!");
>   end;
> end Token_Test

Your code is full of syntax errors, so obviously this isn't
the code you ran.

But anyway, I think your exception handlers are confused.  An exception
handler in a block does not handle exceptions raise in the "declare"
part of the same block.  Ada's syntax is confusing in that regard -- it
LOOKS like they are handled.  This is something Java (for example)
gets right.  Exception handlers shouldn't be syntactically part
of blocks, procedure bodies, etc -- they should have a separate
statement.

- Bob



      parent reply	other threads:[~2012-05-19 20:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-19  2:30 Problem with Delay Alternative in Finalization Tim McGuire
2012-05-19  6:12 ` Dmitry A. Kazakov
2012-05-19 12:51   ` Tim McGuire
2012-05-19 14:04     ` Dmitry A. Kazakov
2012-05-19 19:46   ` Robert Matthews
2012-05-20 16:46     ` Tim McGuire
2012-05-20 17:01       ` Dmitry A. Kazakov
2012-05-20 20:36         ` Simon Wright
2012-05-19 17:33 ` Simon Wright
2012-05-20  6:17   ` Simon Wright
2012-05-19 20:31 ` Robert A Duff [this message]
replies disabled

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