comp.lang.ada
 help / color / mirror / Atom feed
From: Francesco Bochicchio <bockman@virgilio.it>
Subject: Re: redefinition of the operator
Date: Sun, 20 Nov 2005 13:16:20 +0100
Date: 2005-11-20T13:16:20+01:00	[thread overview]
Message-ID: <pan.2005.11.20.12.16.12.433083@virgilio.it> (raw)
In-Reply-To: 2a9izcjijn9f$.1a5pwnzxgaxtz.dlg@40tude.net

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



  reply	other threads:[~2005-11-20 12:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-20  8:49 redefinition of the operator Francesco Bochicchio
2005-11-20 10:50 ` Dmitry A. Kazakov
2005-11-20 12:16   ` Francesco Bochicchio [this message]
2005-11-20 13:27     ` Dmitry A. Kazakov
2005-11-20 21:29     ` Gautier Write-only
2005-11-21 14:23     ` Jean-Pierre Rosen
2005-11-20 11:12 ` Martin Krischik
2005-11-20 12:23   ` Francesco Bochicchio
2005-11-21 14:26   ` Jean-Pierre Rosen
2005-11-21 14:40   ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox