On Sun, 8 Jun 2008 04:48:56 -0700 (PDT), Martin wrote:
> On 8 Jun, 08:35, "Dmitry A. Kazakov" <mail...@[EMAIL PROTECTED]
>
> wrote:
>> package A is
>> <some declarations>
>> exception
>> <handling elaboration problems of A, HOW?> (:-))
>> end A;
>
> Admittedly the range of options is pretty limited if exception
> handlers where to be added to package specs but you could log an
> indication in a package local variable, set a default or re-raise the
> exception.
Aha, so many people are looking for Ada preprocessor! (:-)) What about
catching compile error in with-ing OS.Linux in order to with OS.Windows
instead? (:-))
> I rather like the idea...that forced nesting just to catch an
> exception is quite ugly and dare I day, goes against Ada's "easy to
> read and therefore maintain" mantra...
I think it could be solved in a different way, together with a closely
related problem:
if X in T'Class then
declare
TX : T'Class renames T'Class (X);
begin
...
end;
end if;
if Ptr /= null then
declare
Ptr_All : T renames Ptr.all;
begin
...
end;
end if;
This is a pretty frequent and quite ugly construct, especially because it
verifies the same condition twice.
I think that a fail-safe declaration is in essence a similar thing. It
need
not to appear in the main declaration block, because it a combination of a
flow control and visibility scope.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


|