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-Thread: 103376,99934eaa35a086e8 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!border2.nntp.ams.giganews.com!nntp.giganews.com!zen.net.uk!dedekind.zen.co.uk!news.hacking.dk!pnx.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: Why should the value for a discriminant be static? Date: 09 Feb 2005 23:22:42 +0100 Organization: hacking.dk - Doing fun stuff with open source Sender: sparre@sparre.crs4.it Message-ID: References: NNTP-Posting-Host: 80.241.165.40 Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: xyzzy.adsl.dk 1107987880 8419 80.241.165.40 (9 Feb 2005 22:24:40 GMT) X-Complaints-To: usenet@news.hacking.dk NNTP-Posting-Date: Wed, 9 Feb 2005 22:24:40 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:8217 Date: 2005-02-09T23:22:42+01:00 List-Id: Randy Brukardt writes: > Jacob Sparre Andersen wrote in message > news:rlszmyd956d.fsf@jacob.crs4.it... > > Occasionally I run into the limitation that the value for a > > discriminant be static. I can design my way around the limitation > > (when I remember it), but I would like to know the reason. (also > > because it might make it easier for me to remember the rule) > > The only place I know of off-hand where there is such a limitation > is with aggregates. Yes. That was also what I ran into today. > There, the limitation is necessary so that compiler can know the set > of components for the aggregate. That makes sense. > Otherwise, it would be impossible to check that components are > given, which is *the* major benefit of using an aggregate over a > series of component assignments. Yes. > I suppose such a check could be done at runtime, but that would be > substantially less safe, as errors could exist in a program for a > long time and occur only in unusual conditions after deployment. True. And although I think I also had the record components correct the first time around (except for the non-static discriminant), the changed code is probably safer. > Anyway, does that answer your question, or was this in some other > context? It answers my question. And I think it is enough to make me remember this rule in the future. Thanks. Jacob -- �By becoming continuous, war has fundamentally changed its character. In past ages, a war, almost by definition, was something that sooner or later came to an end, usually in unmistakable victory or defeat.� -- Nineteen Eighty-Four, George Orwell �I don't think you can win [the war on terror].� -- George W. Bush