On Sun, 08 Jun 2008 10:29:53 +0000, Sebastien Morand wrote:
> The problem is, if you can't anymore use the string in the body of
> the function, only in the subblock.
Which is absolutely consistent.
Consider it as follows. When the initialization of an object used in the
subprogram body may fail, that means for the body, that there are two
different cases:
1. Object exists, legally initialized of course [case A]
2. No object exists (because it cannot go through initialization) [case B]
This means that the body shall necessarily consist of two parts. Note that
the precondition of B is weaker than one of A. So B can contain A, but not
reverse. Therefore there exist only two variants:
1. A nested in B (this what Ada provides)
2. A side by side with B. This would require some syntax extensions, like
Niklas has outlined, but without obvious advantages.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


|