(j3.2006) operator(==) and operator(/=)
Kurt W Hirchert
hirchert
Wed Apr 13 16:54:08 EDT 2016
If I remember correctly, the recommendations for IEEE floating point say
that if either or both of A and B are NaNs, both A == B and A /= B
should be false. I believe examples such as this are why we felt it
should be possible to define operator (==) and operator(/=) independently.
I believe we gave at least some consideration to various systems that
would, for example, automatically define operator(/=) in terms of
operator(==) if no explicit definition were provided, but this appeared
to involve too many issues for us to adequately explore at the time, so
we chose not to include any automatic definition system in our initial
version.
As long as we adopt a rule that explicitly provided definitions always
override any implicit definition for the same operator, it would not be
too late to add an implied definition system now. The hard part is
getting the committee to agree on such a system.
-Kurt
On 4/13/2016 2:23 PM, Van Snyder 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 ) )
>
> 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.
>
> One might argue that 7.1.5.4.2p1 (in 10-007r2) gives license to replace
> ( A == B ) with ( .not. ( A /= B ) ), and 7.1.5.5.2 gives license to
> replace ( A <= B ) with ( .not. ( A > B ) ).
>
> So is it really necessary for a scoping unit to have access to both
> operator(==) and operator(/=)?
>
>
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
>
More information about the J3
mailing list