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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1a52c822fc0dbb23 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.germany.com!newsfeed-0.progon.net!progon.net!uucp.gnuu.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Rational for not making cursor tagged in Containers Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1a8y2vakorfhx.225uqh4hifpd$.dlg@40tude.net> <1xmzi7newnilp.23m3zze8h9yi.dlg@40tude.net> <1177066583.5876.30.camel@localhost.localdomain> <1177080147.5876.87.camel@localhost.localdomain> <1q1kx2jlcvnuj.ck0711mj4few$.dlg@40tude.net> <1177097829.26685.36.camel@localhost.localdomain> <95wmj9goo6wc$.13f1j4dnadwws$.dlg@40tude.net> <1177349886.343834.295210@q75g2000hsh.googlegroups.com> <1177373706.552914.71270@q75g2000hsh.googlegroups.com> <1ccueevyp8oba.11c8wwyujtw1o$.dlg@40tude.net> <1177432057.705889.229690@n35g2000prd.googlegroups.com> <1op3ml5q11aa$.vg0a2lyc9dpv$.dlg@40tude.net> <1177549092.325163.326870@b40g2000prd.googlegroups.com> Date: Thu, 26 Apr 2007 09:50:35 +0200 Message-ID: <1ukuo9arhsjuu.1xhbhqzroadfz.dlg@40tude.net> NNTP-Posting-Date: 26 Apr 2007 09:50:35 CEST NNTP-Posting-Host: 09705568.newsspool1.arcor-online.net X-Trace: DXC=inKceNHNS6dFXUDVUnEXQmic==]BZ:afn4Fo<]lROoRaFl8W>\BH3YbHiNC=jUAX4bDNcfSJ;bb[eFCTGGVUmh?dLK[5LiR>kgbC6K]=W@^Z7h X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:15302 Date: 2007-04-26T09:50:35+02:00 List-Id: On 25 Apr 2007 17:58:12 -0700, Adam Beneschan wrote: > On Apr 24, 1:19 pm, "Dmitry A. Kazakov" > wrote: >> On 24 Apr 2007 09:27:37 -0700, Adam Beneschan wrote: >> > Your answer to that didn't really answer the question about predefined > equality, but went into some stuff about user-defined equality. So > we're back where we started. Does the predefined equality compare > just the values, or does it compare the discriminants also? The predefined equality compares memory bit patterns. Observe, that for any fundamental built-in type there is no way to define equality otherwise than this way. An implementation shall ensure that different values of the discriminants and the positions of values render predefined comparison to false. > Hmmm... OK, I see how that might work in that particular case. > However, that does make it seem that, although your idea about putting > discriminants on enumeration literals seems like a nice general idea, > it won't work unless there is only one possible value for the > discriminant for which the enumeration value makes any sense. That's > the case for your GUI_Boolean example---if Defined=True, the > enumeration part of the value can be used, and if Defined=False, the > enumeration part is meaningless. That's not very general, though. > Suppose, for example, you wanted a GUI_Boolean with three states: > Not_Defined, Defined_By_Config, Defined_By_User, where the latter two > states would distinguish whether a Boolean value were set by some > default present in a configuration file (or the Winodws registry, > say), or were explicitly entered by the user. Now you can't really do > this, without adding extra syntax and semantics to the language: > > type GUI_State is (Not_Defined, Defined_By_Config, > Defined_By_User); > type GUI_Boolean (State : GUI_State := ???) is (False, True); > > Whichever value you pick for the default State---Defined_By_Config or > Defined_By_User---you don't have a way to set up a GUI_Boolean whose > state is the other one and whose value is one of the False/True > literals. Yes, and this is a desired feature. It is important to clearly understand that discriminant is not yet-another-record-field. Discriminant is a constraint put on the values. If you have two values of the type and three values of the constraint, then it shouldn't wonder you that this construct wouldn't be much usable. What is the difference between Defined_By_Config True and Defined_By_User True? Just bad design and language misuse. --------------- My point was, logically and semantically any type may have discriminants = be dynamically constrained. It is quite difficult (IMO impossible) to show why some special classes of types may not be constrained. There exist very strong cases for real, access and array types which indeed require discriminants. I mentioned them in other posts. The rest is basically enumeration types and Robert Duff asked for an example for Boolean type. It was a challenge to think an example out, I hope you enjoyed it. For a more elaborated enumeration type I would probably propose dynamically constrained ranges of, or something similar. But again, that was not the point. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de