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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,26aa6d7095c151 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-18 15:01:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi_feed3!attbi.com!sccrnsc03.POSTED!not-for-mail From: "Jeffrey Creem" Newsgroups: comp.lang.ada References: <3DAFC542.152C0EE0@lml.ls.fi.upm.es> Subject: Re: Porting from Modula-2 to Ada X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: NNTP-Posting-Host: 66.31.5.146 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc03 1034978461 66.31.5.146 (Fri, 18 Oct 2002 22:01:01 GMT) NNTP-Posting-Date: Fri, 18 Oct 2002 22:01:01 GMT Organization: AT&T Broadband Date: Fri, 18 Oct 2002 22:01:01 GMT Xref: archiver1.google.com comp.lang.ada:29930 Date: 2002-10-18T22:01:01+00:00 List-Id: "Lutz Donnerhacke" wrote in message > > generic types define the most restrictive assumptions can be made on every > real type: You can instantiate a limited generic type with an ordinary one. > That is exactly my point. I believe one should instantiate that generic with "normal" types and private types but never (or almost never) limited private types. One could argue that the limited types should be allowed here "just in case" it makes sense but these cases are much more rare than the cases where someone would accidentally believe they can use a limited type here when they can not. > When removing the limited constraint from the generic definiton, you allow > the generic program to copy variables of the generic type. So you are never > allowed to instantiate this construct with a limited type. yup....When someone makes something limited, they remove assignment, they remove "=" this usually means that one can not make reasonable assumptions about the data in the type (could be a pointer to a linked list, address of something, etc).. Again, I don't argue that there would never be a case where it would make sense to use a limited type..But I have never seen one where it would. > > > Also, it is worth checking in the generic body that the 'size of the type > > is a multiple of the 'size of the storage element (or whatever type you > > use to write to the file) > > You didn't read my code. :-/ Actually your code is doing reasonable things and avoiding common errors (by writing out all storage elements associated with the data) but it is not doing what I was suggested. Depending on what these procedures are used for it can be useful to know that the "actual useful" data is not a multiple of storage element sizes. This is less imporant on write commands like this but can be a problem on the read equivilent when some unexpected piece of data in a packed structure gets overwritten.