(j3.2006) operator(==) and operator(/=)
Bill Long
longb
Wed Apr 13 17:40:28 EDT 2016
If you overload the == operator with a generic OPERATOR(==) it is not even required that the result of the implementation function be of type logical. In a case like that I don?t see why there is necessarily a link to the OPERATOR(/=).
On Apr 13, 2016, at 4:30 PM, Damian Rouson <damian at sourceryinstitute.org> wrote:
>
>> On Apr 13, 2016, at 12:23 PM, Van Snyder <Van.Snyder at jpl.nasa.gov> wrote:
>>
>> I was a bit surprised to discover that (apparently) defining
>> operator(==) does not define operator(/=), and that a scoping unit is
>> not prohibited from having access to both.
>>
>> Was there a conscious reason we did not (indirectly) require
>>
>> ( A == B ) .eqv. ( .not. ( A /= B ) )
As Kurt pointed out, this requirement is already broken for the intrinsic operators.
Cheers,
Bill
>>
>> by specifying that only a definition of operator(==) or operator(/=) can
>> be accessible in a scoping unit, and the other one is automatically
>> defined?
>>
>> Or was this just an oversight?
>>
>> It's too late to change it now, but I'm still curious whether there was
>> a thought process involved.
>>
>> One might argue that also
>>
>> ( A <= B ) .eqv. ( .not. ( A > B ) )
>>
>> etc., but perhaps that's too much thinking to do before breakfast.
>
>
> Like Tom, I can?t make any related historical statements. I?ll simply comment that
> there are several other similar cases in which the processor could supply an obvious
> implementation using a defined operator. Given a defined operartor(+) for a type,
> the processor could supply the obvious implementation for SUM. Given a defined
> operator(+) and a defined operator(*), the processor could supply the obvious
> implementations for DOT_PRODUCT and NORM2.
>
> Damian
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101
More information about the J3
mailing list