Talk About Network

Google





Programming > Ada > Re: About Strin...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 38 Topic 5743 of 6006
Post > Topic >>

Re: About String

by Niklas Holsti <niklas.holsti@[EMAIL PROTECTED] > Jun 8, 2008 at 02:14 PM

Dmitry A. Kazakov wrote:
> On Sun, 08 Jun 2008 09:47:30 +0300, Niklas Holsti wrote:
> 
> 
>>The solution is just to add one more "begin..end" block, enclosing 
>>the "declare .. begin .. end", and handle the exceptions in this 
>>outer "begin..end" block. Or handle the exceptions in the 
>>subprogram's "begin..end" block and nest the "declare..begin..end" 
>>within the subprograms "begin..end".
>>
>>That said, I admit that I, too, have made this mistake once or 
>>twice. But not lately.
> 
> 
> If exceptions were contracted such, quite nasty, errors could be
detected
> at compile time.

Only if the programmer specifies the exception contracts separately 
for the declarative parts and the statements. I don't remember any 
such proposals.

>>I wonder if it would be a good idea for Ada to allow an exception 
>>handler also in the "declare" part, as follows:
>>
>>    -- NOT Ada!
>>    declare <some variables>
>>    exception <handle exceptions raised in the declarations>
>>    begin <some statements>
>>    exception <handle exceptions raised in the statements>
>>    end;
>>
>>Of course, in this proposal the declaration-exception handler would 
>>not have access to the declared variables.
> 
> 
> But then, for regularity sake, you would need to add exception handling
to
> all declarative parts:

And why not?

> package A is
>     <some declarations>
> exception
>     <handling elaboration problems of A, HOW?>  (:-))
> end A;

It seems, from your smiley, that you feel that such a structure 
would be somehow impossible. I don't see why; the exception handler 
could execute any sort of non-erroneous code that could be executed 
in any subprogram called as part of the declarations in package A. 
For example, it could set some flag in another package to inform 
the application that package A cannot be used because its 
elaboration failed. If the application uses run-time elaboration 
checks, it could even continue executing, as long as it does not 
try to use anything in A. I admit that this might need an extended 
form of run-time elaboration checks.

I'm not suggesting that this feature (exception handlers in package 
declarations) is desirable, but I don't think it would be 
impossible, and it could even be useful in some applications.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @[EMAIL PROTECTED]
       .
 




 38 Posts in Topic:
About String
=?ISO-8859-1?Q?S=E9bastie  2008-06-06 17:29:43 
Re: About String
Simon Wright <simon.j.  2008-06-07 17:18:12 
Re: About String
Pascal Obry <pascal@[E  2008-06-07 19:01:07 
Re: About String
Chris Moore <zmower@[E  2008-06-07 23:13:16 
Re: About String
Niklas Holsti <niklas.  2008-06-08 09:47:30 
Re: About String
"Dmitry A. Kazakov&q  2008-06-08 09:35:31 
Re: About String
Sebastien Morand <seb.  2008-06-08 10:29:53 
Re: About String
"Dmitry A. Kazakov&q  2008-06-08 12:53:16 
Re: About String
Niklas Holsti <niklas.  2008-06-08 14:14:04 
Re: About String
"Dmitry A. Kazakov&q  2008-06-08 15:16:54 
Re: About String
Niklas Holsti <niklas.  2008-06-08 20:17:33 
Re: About String
"Dmitry A. Kazakov&q  2008-06-09 09:26:26 
Re: About String
Chris Moore <zmower@[E  2008-06-08 19:26:21 
Re: About String
Robert A Duff <bobduff  2008-06-08 14:32:36 
Re: About String
Simon Wright <simon.j.  2008-06-08 12:13:50 
Re: About String
Sebastien Morand <seb.  2008-06-08 19:03:17 
Re: About String
Martin <martin.dowie@[  2008-06-08 04:48:56 
Conditional declarations (was: About String)
"Dmitry A. Kazakov&q  2008-06-08 15:17:03 
Re: About String
Maciej Sobczak <see.my  2008-06-08 13:51:07 
Re: About String
Robert A Duff <bobduff  2008-06-08 17:19:11 
Re: About String
"Dmitry A. Kazakov&q  2008-06-09 09:14:30 
Re: About String
Georg Bauhaus <rm.dash  2008-06-09 11:43:36 
Re: About String
"Dmitry A. Kazakov&q  2008-06-09 12:25:02 
Re: About String
=?ISO-8859-1?Q?S=E9bastie  2008-06-09 10:42:18 
Re: About String
Georg Bauhaus <rm.dash  2008-06-09 13:43:21 
Re: About String
"Dmitry A. Kazakov&q  2008-06-09 14:03:37 
Re: About String
Robert A Duff <bobduff  2008-06-15 15:38:08 
Re: About String
"Dmitry A. Kazakov&q  2008-06-15 22:52:45 
Re: About String
Robert A Duff <bobduff  2008-06-15 18:06:00 
Re: About String
"Dmitry A. Kazakov&q  2008-06-16 10:31:03 
Re: About String
Robert A Duff <bobduff  2008-06-16 15:17:15 
Re: About String
"Dmitry A. Kazakov&q  2008-06-16 22:30:12 
Re: About String
Georg Bauhaus <rm.tsoh  2008-06-17 00:02:51 
Re: About String
Robert A Duff <bobduff  2008-06-16 19:04:54 
Re: About String
Georg Bauhaus <rm.dash  2008-06-09 13:00:44 
Re: About String
Robert A Duff <bobduff  2008-06-15 15:48:49 
Re: About String
Britt Snodgrass <britt  2008-06-09 07:27:05 
Re: About String
Robert A Duff <bobduff  2008-06-15 15:50:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 13:53:26 PST 2009.