comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Constant record components
Date: Fri, 7 Jul 2006 16:04:13 -0500
Date: 2006-07-07T16:04:13-05:00	[thread overview]
Message-ID: <K4OdnXFtjqm9UTPZnZ2dnUVZ_q-dnZ2d@megapath.net> (raw)
In-Reply-To: 12arsrtbe8flpf8@corp.supernews.com


"ME" <abcdefg@nonodock.net> wrote in message
news:12arsrtbe8flpf8@corp.supernews.com...
> What I am looking for is a way to read in a values from a file ,assign
them
> once to  records and disallow any future assignment i.e. these "constant
> parts of the records represent a structure that I don't want to ever
change
> during the life of the program (write once and read only afterwards).  It
> would be similar to a constant declaration but inside of a record. I don't
> think that it is disgusting at all.

The problem with that is that the Initialize routine is just an ordinary
subprogram. That means that either constant components can't be initialized
with them (only directly when the object is created), or you have to have
some rule like "they're read-write in the body", which is what is
disgusting. And remember that Initialize isn't the only routine of this
type; user-defined Read and Input routines also need this property.

There are also issues on complete record assignment of objects with constant
components: what happens if one of the constant components changes? If it
doesn't change (raises Constraint_Error), then you have a discriminant
(effectively); if it does change, then how constant is it??

There may in fact be a solution to these issues, but it has never seemed
important enough to spend the intensive effort needed to find one.

                                    Randy.





  parent reply	other threads:[~2006-07-07 21:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <12ad8guf3sg1o0d@corp.supernews.com>
2006-07-01 17:06 ` Constant record components Dmitry A. Kazakov
2006-07-01 17:37   ` ME
2006-07-01 18:33     ` Georg Bauhaus
2006-07-01 21:44       ` Jeffrey R. Carter
2006-07-02  9:18         ` Georg Bauhaus
2006-07-02 16:13   ` ME
2006-07-03  7:50     ` Dmitry A. Kazakov
2006-07-03 11:46       ` Craig Carey
2006-07-04  0:06         ` M E Leypold
2006-07-03 16:31       ` ME
2006-07-03 23:53         ` Randy Brukardt
2006-07-04  1:59           ` Craig Carey
2006-07-04  7:25           ` ME
2006-07-05 21:55             ` Randy Brukardt
2006-07-06  0:59               ` tmoran
2006-07-06  7:47               ` Jean-Pierre Rosen
2006-07-06 22:29                 ` Randy Brukardt
2006-07-07  4:34                   ` Jeffrey R. Carter
2006-07-07  5:39                   ` ME
2006-07-07  9:15                     ` Georg Bauhaus
2006-07-08 16:13                       ` ME
2006-07-08 17:14                         ` Georg Bauhaus
2006-07-13  6:58                           ` ME
2006-07-13  8:39                             ` Georg Bauhaus
2006-07-07 21:04                     ` Randy Brukardt [this message]
2006-07-14  8:15                       ` Craig Carey
2006-07-14 12:51                         ` Craig Carey
2006-07-15  3:45                           ` ME
2006-07-04  0:08         ` M E Leypold
2006-07-02  5:52 ` Craig Carey
replies disabled

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