Equality test.
Every expression with the ==
operator becomes a call to
this function, i.e. a==b
is the same as
predef::`==(a,b)
.
If more than two arguments are given, each argument is compared
with the following one as described below, and the test is
successful iff all comparisons are successful.
If the first argument is an object with an lfun::`==() , that
function is called with the second as argument, unless the
second argument is the same as the first argument. The test is
successful iff its result is nonzero (according to `! ).
Otherwise, if the second argument is an object with an
lfun::`==() , that function is called with the first as
argument, and the test is successful iff its result is nonzero
(according to `! ).
Otherwise, if the arguments are of different types, the test is
unsuccessful. Function pointers to programs are automatically
converted to program pointers if necessary, though.
Otherwise the test depends on the type of the arguments:
int | Successful iff the two integers are numerically equal.
|
float | Successful iff the two floats are numerically equal or if
both are NaN.
|
string | Successful iff the two strings are identical, character for
character. (Since all strings are kept unique, this is
actually a test whether the arguments point to the same
string, and it therefore run in constant time.)
|
array|mapping|multiset|object|function|program|type(mixed) | Successful iff the two arguments point to the same instance.
|
|