From: bobduff@world.std.com (Robert A Duff)
Subject: Re: overload ":=" ???
Date: 1996/07/23
Date: 1996-07-23T00:00:00+00:00 [thread overview]
Message-ID: <Dv0991.6yB@world.std.com> (raw)
In-Reply-To: TARJEIJ.96Jul23153224@ulrik.uio.no
In article <TARJEIJ.96Jul23153224@ulrik.uio.no>,
Tarjei Jensen <tarjeij@ulrik.uio.no> wrote: The problem with bounded
>string is that it assigns a global maximum string size instead of
>letting each string have its own maximum size.
True. But it's not particularly a problem with the bounded strings
package. The problem is that discriminant constraints are checked for
equal-discrims on assignment.
>... The former is not
>particularly flexible while the latter really require a user defined
>":=".
Or a user-define "implicit conversion" operation. An earlier version of
Ada 9X solved this problem.
>Not the least because the maximum length of the strings might be different.
>
>e.g:
>
> a : counted_string(4) := "1234";
> b : counted_string(5) := "1234"; -- four characters and space for five
>
> a := b; -- Will not work with current version of Ada
True. The expectation is that you'll instantiate the generic
approximately once per program (or subsystem) with a "reasonable" max
such as 80, or 200, or whatever.
Note that typical implementations of Pascal that support a similar thing
usually choose the max for you (often 255).
Note also that bounded strings are for applications that want to avoid
the overhead and unpredictability of heap-allocated strings -- e.g.
many real-time/embedded applications. If you want flexibility, use
unbounded strings, and pay for heap allocation.
Anyway, I agree that what you're asking for would be nice. Not quite
nice enough to warrant changing rules about discriminant constraints,
apparently, though.
>While I am in wishing mode I would very much like a third alternative
>to the values of S'Bit_Order. I would very much like to have
>Most_Significant_Byte_First as a choice (Network order for those who
>are curious).
Shouldn't that be S'Byte_Order? Ask you favorite compiler vendor for an
implementation-defined attribute.
- Bob
next prev parent reply other threads:[~1996-07-23 0:00 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-17 0:00 overload ":=" ??? David Morton
1996-07-17 0:00 ` Robert Dewar
1996-07-18 0:00 ` David Morton
1996-07-19 0:00 ` Brad Balfour
1996-07-19 0:00 ` David Weller
1996-07-18 0:00 ` Laurent Guerby
1996-07-25 0:00 ` Wolfgang Gellerich
1996-07-25 0:00 ` Robert A Duff
1996-07-18 0:00 ` Jon S Anthony
1996-07-18 0:00 ` John Herro
1996-07-18 0:00 ` Robert Dewar
1996-07-19 0:00 ` John Herro
1996-07-21 0:00 ` David Morton
1996-07-21 0:00 ` Laurent Guerby
1996-07-22 0:00 ` Robert A Duff
1996-07-23 0:00 ` Laurent Guerby
1996-07-23 0:00 ` Robert A Duff
1996-07-23 0:00 ` John Herro
1996-07-22 0:00 ` David Morton
1996-07-22 0:00 ` Robert Dewar
1996-07-23 0:00 ` Robert A Duff
1996-07-22 0:00 ` Robert Dewar
1996-07-22 0:00 ` Laurent Guerby
1996-07-22 0:00 ` Laurent Guerby
1996-07-23 0:00 ` Tarjei Jensen
1996-07-23 0:00 ` Robert A Duff [this message]
1996-07-24 0:00 ` Robert I. Eachus
1996-07-19 0:00 ` Joerg Ozimek
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox