From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4bce46ddadaa9806 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: What is wrong here? (Generic and controlled types) Date: 2000/04/06 Message-ID: <8ci9g2$u9l$1@nnrp1.deja.com>#1/1 X-Deja-AN: 607574617 References: <38E871E6.8D9EBE71@lufmech.rwth-aachen.de> <8caebe$6us$1@nnrp1.deja.com> <8cahmn$apq$1@nnrp1.deja.com> <8catei$n8$1@slb6.atl.mindspring.net> X-Http-Proxy: 1.0 x23.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Thu Apr 06 15:12:19 2000 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; I) Date: 2000-04-06T00:00:00+00:00 List-Id: In article <8catei$n8$1@slb6.atl.mindspring.net>, swhalen@netcom.com wrote: > Robert Dewar wrote: > : It is almost always possible to work around this trivially by > : simply including a controlled component in the type instead > : of making the entire type controlled. > > : P.S. it is hard to see how the GNAT message could be any > : clearer, suggestions welcome! > > 29. package Real_Vectors is new Generic_Vectors(Real, Index, Zero); > | > >>> instantiation error at generic_vectors.ads:23 > >>> controlled type must be declared at the library level > >>> (consider including controlled component instead > >>> of making entire type controlled?) > > I know I'd appreciate getting a helpful hint like this, even > though I have no reason to expect the compiler to do so. For me that's going too far, since most often the solution is simply to avoid the nesting that is causing the trouble, and there are dozens of other possible solutions. TO fix on this one would be misleading more often than not. Yes, it would be nice if compilers could help write your program for you, and they do try to help a bit, but if they go too far in this direction, they start becoming actively unhelpful. Finding just the right balance is not always easy. Generally we avoid programming advice in messages unless it is VERY likely to be correct, e.g. it is almost certainly right to suggest adding ALL to make an access type general when aliased is used incorrectly with a pool specific access type Sent via Deja.com http://www.deja.com/ Before you buy.