comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey Creem" <jeff@thecreems.com>
Subject: Re: Porting from Modula-2 to Ada
Date: Fri, 18 Oct 2002 22:01:01 GMT
Date: 2002-10-18T22:01:01+00:00	[thread overview]
Message-ID: <xw%r9.1184$md1.173@sccrnsc03> (raw)
In-Reply-To: slrnaqvrlo.nv.lutz@taranis.iks-jena.de


"Lutz Donnerhacke" <lutz@iks-jena.de> 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.






  reply	other threads:[~2002-10-18 22:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-18  8:24 Porting from Modula-2 to Ada Manuel Collado
2002-10-18  9:45 ` Bernd Specht
2002-10-18 10:33   ` Lutz Donnerhacke
2002-10-18 10:55     ` Jeffrey Creem
2002-10-18 11:21       ` Lutz Donnerhacke
2002-10-18 22:01         ` Jeffrey Creem [this message]
2002-10-18 21:29     ` Jeffrey Carter
2002-10-18 21:39       ` Jeffrey Carter
2002-10-18 11:20 ` Nicolas Cailín Paul Gloster
2002-10-18 15:14   ` Pat Rogers
2002-10-24 14:51     ` Colin Paul Gloster
2002-10-25  3:43       ` Dennis Lee Bieber
2003-02-04 14:12       ` Colin Paul Gloster
2003-02-09  6:07         ` Robert I. Eachus
2002-10-19 13:30 ` SteveD
2002-10-22  7:48   ` Manuel Collado
2002-10-22  7:55 ` Manuel Collado
2002-10-22 18:56   ` Jeffrey Carter
2002-10-23  9:08     ` Manuel Collado
replies disabled

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