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,FREEMAIL_FROM autolearn=ham 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!news.glorb.com!news.newsland.it!feeder.news.tin.it!spool.news.tin.it!not-for-mail From: Francesco Bochicchio Subject: Re: redefinition of the operator Date: Sun, 20 Nov 2005 13:16:20 +0100 User-Agent: Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux)) Message-Id: Newsgroups: comp.lang.ada References: <2a9izcjijn9f$.1a5pwnzxgaxtz.dlg@40tude.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Organization: TIN.IT (http://www.tin.it) X-Comments: Please send technical notifications to newsmaster@tin.it NNTP-Posting-Host: 87.1.255.187 X-Trace: 1132488941 reader3.news.tin.it 16207 87.1.255.187:32781 X-Complaints-To: Please send abuse reports to abuse@tin.it Xref: g2news1.google.com comp.lang.ada:6502 Date: 2005-11-20T13:16:20+01:00 List-Id: Il Sun, 20 Nov 2005 11:50:47 +0100, Dmitry A. Kazakov ha scritto: > 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. > Thanks. I will try. It is not exactly a cheap solution, since I need to replace the standard operators in existing software (about 20000 DSI) and this mean to change long_float with My_Real in most of it, but I guess with some automated search/replace I could do it. Ciao ------ FB