comp.lang.ada
 help / color / mirror / Atom feed
* Re: Refactoring and Ada
@ 2002-02-20  6:19 Christoph Grein
  2002-02-20 17:52 ` Valid for composite (was Re: Refactoring and Ada) kumano
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Grein @ 2002-02-20  6:19 UTC (permalink / raw)


> > It turns out that 'Valid is not as useful as many of us thought it was. For
> > example,  the result of an erroneous result from unchecked conversion,
> > which we originally thought was harmless if we checked it ourselves
> > with 'Valid before using it is a problem.   Consider the following,
> > 
> >                type X is ... ;
> >                type Y is ... ;
> > 
> >                function Convert is new Ada.Unchecked_Conversion
> >                                          (Source => Y, Target => X);
> > 
> >                 X := Convert (Y);     -- suppose X is erroneous or not valid
> >                 if X'Valid then ...      -- We used to think this was OK.
> >                                                  -- Some compilers fail on 
this because of an
> > interpretation
> >                                                  -- of the ALRM rules.
> > 
> >  At present, one must wonder about the usefulness of 'Valid.
> 
> There is an AI with a binding interpretation that was included in the
> TC that says that at least for scalar types the above code is
> not errorious and must work as expected.
> 
> SO any compiler that fail on the above are non-compliant.

I've got  the AARM with COR.1:2000 in front of me. There are no changes in 13.9, 
13.9.1, 13.9.2.
Thus a compiler failing to handle the above correctly has always been buggy.

Note that 'Valid exists for scalar objects only.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Valid for composite (was Re: Refactoring and Ada)
  2002-02-20  6:19 Refactoring and Ada Christoph Grein
@ 2002-02-20 17:52 ` kumano
  0 siblings, 0 replies; 2+ messages in thread
From: kumano @ 2002-02-20 17:52 UTC (permalink / raw)


Christoph Grein wrote:
> Note that 'Valid exists for scalar objects only.

'Valid for composite could be implemented as language extension.

See
 http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AC-00006.TXT?rev=1.2

-- 
Toshitaka Kumano



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-20 17:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-20  6:19 Refactoring and Ada Christoph Grein
2002-02-20 17:52 ` Valid for composite (was Re: Refactoring and Ada) kumano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox