`equal(``x`

, `y`

)

Note that this method does *not* overload
the function `_equal`

,
i.e. the `=`

operator. The function `_equal`

cannot be overloaded.

`coerce(``x`

)

The implementation provided tries to convert `x`

into
an element of this domain by first calling `dom::convert(x)`

and
then, if this fails, `x::dom::convert_to(x, dom)`

;
it retuns `FAIL`

if both methods fail.

`equiv(``x`

, `y`

)

The implementation provided tries to convert `x`

and `y`

into
elements of this domain and then calls `dom::equal`

with
these elements. It returns `FAIL`

if the conversion
fails or the equality test returns `UNKNOWN`

.

`new(``x`

)

Given a domain `D`

, an expression of the form `D(x,...)`

results
in a call of the form `D::new(x,...)`

.

The implementation provided here tries to convert `x`

by
calling `dom::convert(x)`

and returns the result.
It raises an error if `dom::convert`

returns `FAIL`

.

`print(``x`

)

Please do *not* print directly in this method
by calling the function `print`

for
example!

The implementation provided here is `dom::expr`

.

`testtype(``x`

, `T`

)

This method must return `TRUE`

if it can decide
that `x`

is of type `T`

, `FALSE`

if
it can decide that `x`

is not of type `T`

and `FAIL`

if
it can not decide the test.

This method is called in three different situations: Either
if the argument `x`

is of this domain, or if `T`

is
this domain, or if `T`

is an element of this domain.
Thus the following three situations can arise:

`x`

is an element of the current
domain.

In this case it must be tested if `x`

may be
regarded as an element of the type `T`

, which may
either be a domain or type expression. By default, this is only true
if the domain type of `x`

is `T`

,
or if `T`

is a domain constructor for which ```
x::dom::hasProp(x,
T)
```

is `TRUE`

.
In particular, `x`

is, by default, not of type `T`

if `T`

is
a type of the Type library.

`T`

is the current domain.

In this case it must be tested if `x`

may be
regarded as an element of this domain. By the default implementation
provided, this is `TRUE`

only if the domain type of `x`

is `dom`

.

`T`

is an element of the current
domain.

In this case `T`

is regarded as a type expression.
The default implementation provided returns `TRUE`

if the domain type
of `x`

is `T`

, and `FAIL`

if not. A special
rule holds if `T`

is a façade domain: in that
case, `coerce(x,T)`

is called, if this is successful `TRUE`

is
returned and `FAIL`

if not.

`new_extelement(``x, …`

)

When an expression `new(D,x,...)`

is evaluated
and `D`

is a domain with method `"new_extelement"`

,
then `D::new_extelement(D,x,...)`

is evaluated and
returned as result.

Kernel or façade domains must define this method because
otherwise the function `new`

would
return a "container" element of `D`

rather
than a "raw" element as intended.

The implementation provided here returns the result of `D::new(x,...)`

.