TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Tucker Taft <[log in to unmask]>
Sun, 4 Mar 2001 09:42:32 -0500
Tucker Taft <[log in to unmask]>
text/plain (28 lines)
One issue is that 'Valid is not easily implementable on
components that are of an access type.  This is one of the
reasons we didn't provide a composable 'Valid attribute.
And of course for a private type, the validity conditions are
typically user-defined.  There are also types that might have implicit
components, such as types with nested dynamic-sized arrays or records.

Nevertheless it would be possible to define a composable 'Valid
but there would have to be several caveats.  The alternative,
presuming there are not a lot of unchecked conversion instantiations in a
given program, is to make the target object aliased, and then pass
the 'Access of it to a user-written subprogram to do a user-defined
validity check.

Sometimes rather than building something in to
the language, we concluded it was a "programming problem" and it
was better to provide the "building blocks" to allow the programmer
to solve it, rather than trying to provide the end-all and be-all
builtin feature.

In this case, it might have been better to provide some kind of
composable 'Valid, though I am not sure.  In any case, presuming
your program is not rife with Unchecked_Conversions, you can probably
do what needs to be done yourself, albeit with more effort during
development and maintenance.

-Tucker Taft  [log in to unmask]