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,9ce095aba33fe8d0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!news2.volia.net!solnet.ch!solnet.ch!proxad.net!proxad.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Negative float problem Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.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: <1130351574.313991.229420@g14g2000cwa.googlegroups.com> Date: Thu, 27 Oct 2005 20:33:21 +0200 Message-ID: <6s69njyr9afb$.495n3zrpezwy$.dlg@40tude.net> NNTP-Posting-Date: 27 Oct 2005 20:33:10 MEST NNTP-Posting-Host: 9f13cc84.newsread4.arcor-online.net X-Trace: DXC=H5nGJUbSNYRMYeRE0Pb_HU:ejgIfPPldTjW\KbG]kaMXU7^]5?JhlB^DF:b`=nH@UW[6LHn;2LCV^[eY X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:6007 Date: 2005-10-27T20:33:10+02:00 List-Id: On 27 Oct 2005 10:48:24 -0400, Robert A Duff wrote: > A more realistic example is "for I in -10 .. 10". ;-) > > But that's a completely separate issue from what the OP asked about. > The problem here is that Ada makes the type default to > Integer. That's a kludge. Right. It could be a "universal [integer] range" instead, so that within the loop "I" would be a universal integer. > I would simply require the > user to write "for I in Integer range -10..10", if they > want Integer. I suppose, if "I" were universal, type specification would not be required. >>...Tucker came up with some preference rules that handle some >> of the cases, but the case mentioned here is one of the more refractory >> ones. It could be solved by having a negation symbol that could be part >> of a numeric literal. > > Perhaps. Would "- 10" and "-10" then have different semantics?! > ^ > | That's a blank. -(-(-10)) >>...(Yes, >> there is a different set of rules for basic operations like numeric >> literals and assignment. But since these are not overloadable, this >> doesn't cause a problem.) >> >> Finally, there is actually a third way to make the negation operator >> from file1 visible. But note that this is direct visibility not use >> visible: >> function "-"(L: My_Float) return My_Float renames file1."-"; > > That one is error prone, too. The problem here is that you don't want > to rename anything, so using "renames" is overkill. The thing is still > called "-" -- you don't want to rename it, you want to import it with > the same name it always had. Ada has no such feature. Right. There is no way to have "use" transitive. I often need to combine specifications of several packages in the specification of a third package which then could be "with/use"-ed. The only way to do it is to rename all and everything in that specification. It is clumsy and error prone. Then because renaming was designed improperly in Ada, when the source packages occasionally get "use"-ed, names hide each other. With generics, tracking such errors becomes a nightmare. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de