object expression

An object expression allows the declaration of an anonymous object within a declaration.

Usage

An example of an object expression being used in a return statement:

return object extends Foo() satisfies Bar {
    // ...
};

Description

An object expression is basically a shorthand for a local object declaration. The example above could have been written:

object foo extends Foo() satisfies Bar {
    // ...
};
return foo;

Type

The type of a let expression is the type of the object expression, which is the intersection of the given extended class type and satisfied interfaces types.

See also