Newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object,comp.software-eng
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!cam-news-feed3.bbnplanet.com!news.bbnplanet.com!cpk-news-hub1.bbnplanet.com!news.sprintlink.net!news-peer.sprintlink.net!uunet!in3.uu.net!uucp6.uu.net!alexandria.organon.com!alexandria!jsa
From: jsa@alexandria (Jon S Anthony)
Subject: Re: OO, C++, and something much better!
Message-ID: <JSA.97Jan16141937@alexandria>
Sender: news@organon.com (news)
Organization: Organon Motives, Inc.
Date: Thu, 16 Jan 1997 19:19:37 GMT
Lines: 52
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:240862 comp.lang.smalltalk:49243 comp.lang.eiffel:17393 comp.lang.ada:56064 comp.object:59910 comp.software-eng:52607


Don writes:

> Jon S Anthony writes:							    
> 									      
> :> For example, by using the value of a parent type where a subrange	    
> :> value is required.							    
> :									    
> :Give an example.							    
> 									      
> The following is a valid Ada83 program (and presumably valid Ada95):	    
> 									      
> procedure Test_Type_Hole is						    
>   subtype Sub_Integer is Integer range 1 .. 10;				    
>   I: Integer;								    
>   S: Sub_Integer;							    
> 									      
>   procedure Use_Subtype (S: Sub_Integer) is				    
>   begin									    
>     null;								    
>   end;									    
> 									      
> begin									    
>   I := 1000;								    
>   Use_Subtype (I);       -- System Invalid call - raises 		    
> 			   -- Constraint_Error at runtime.		    
> end Test_Type_Hole;							    
> 									      
> So, contrary to your claim, Ada *does* permit a form of broken polymorphism.

Don.  What in the world are you talking about???  This is just plain
wrong and even borders on outright silly.  Where's the polymorphism of
any form here?  Subtypes are ways of defining constraints (simple
"assertions") on the possible values of the type.  Sub_Integer is not
a new type and is not a type derivation.  So, you only have one type
here (Re: RM: 3.2(8))

The CE, is simply stating that you have violated the constraint
(assertion).  No polymorphism broken or otherwise involved.

Also, while it is certainly not necessary, this case is so simple (for
DFA) I am a little surprised that GNAT did not give a warning about
this at compile time.

/Jon
-- 
Jon Anthony
Organon Motives, Inc.
Belmont, MA 02178
617.484.3383
jsa@organon.com

