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,9ec92fb9d5eb54fd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeedt0.toon.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: redefinition of the operator 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: Date: Sun, 20 Nov 2005 11:50:47 +0100 Message-ID: <2a9izcjijn9f$.1a5pwnzxgaxtz.dlg@40tude.net> NNTP-Posting-Date: 20 Nov 2005 11:50:45 MET NNTP-Posting-Host: 4ab93512.newsread4.arcor-online.net X-Trace: DXC=XR=;8UeFbSWda:jMWf@:ejgIfPPldDjW\KbG]kaMHFYk:AnJB[CMJ2jaXjlALXN[6LHn;2LCVN[ On Sun, 20 Nov 2005 09:49:55 +0100, Francesco Bochicchio wrote: > I need to redefine the standard mathematic operators, to replace them with > my own version. > > So, if I do something like this, it works: > > -- ****************************** > procedure Test_MyOperators is > A,B : Long_Float; > function "+"(X, Y : Long_Float) return Long_Float > is > begin > return X; > end; > > begin > A := 1.0; > B := 2.0; > > if A = A+B then > Put_Line("Yes."); > else > Put_Line("No"); > end if; > end; > -- ------------------------------------- > > But since I have many packages, I want to put the redefined operators > in a separate package, say MY_OPERATORS, and doing instead: Define a new type and its operations in one package: package My_Operators is type My_Real is new Long_Float; function "+" (Left, Right : My_Real) return My_Real; end My_Operators; > -- ************************************* > > with MY_OPERATORS; use MY_OPERATORS; > > procedure Test_MyOperators is > A,B : Long_Float; Use My_Real instead. > begin > A := 1.0; > B := 2.0; > > if A = A+B then > Put_Line("Yes."); > else > Put_Line("No"); > end if; > end; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de