:: Re: [DNG] another programming langu…
Etusivu
Poista viesti
Vastaa
Lähettäjä: Didier Kryn
Päiväys:  
Vastaanottaja: dng
Aihe: Re: [DNG] another programming language question
Le 25/10/2024 à 13:24, karl@??? a écrit :
> If you enclose more than a few lines of code in a try block, then you
> will loose the sense of where it happened.
>
> To solve that I have made some macros [1] so you always can check
> the return value without much clutter. From what I understand you
> cannot do something similar in e.g. ada, leading you to more clutter
> or the habit of enclosing bigger chunks of code in try/catch or
> altogether skipping it, which to me seems to be just as bad as
> ignoring the return value.


    In a program or subprogram body in Ada, you ave three sections
separated by the following lines:

declare,

begin,

exception.

    The last section, which is optionnal, is where you decide what to
do with exceptions, either cure the problem, print some smart
information, convert it to another exception and forward it to the
caller, or what else.

    After the "begin" and before the "exception" or the "end", is where
the normal algorithm happens. In this part, you don't care about
exceptions, except you can raise some, of course.

--     Didier