Components
This framework offers component-based development. Components exist at various levels of development and can be combined into larger components. Components can also contain sub-components. A component defines a composable entity whose role can vary from a driver to a functional component.
A component contains two entities: an interface, which is shared between all components of the same type, and an implementation-specific configuration.
For example, we will define a square whose interface is a generic shape.
interface Shape
{
using Area = Integer [min(0)];
method surface() -> Area;
}
component Square : Shape
{
config:
width = Integer;
}
A square is defined by its width. Such a component is instantiated from a composable scope:
This component exposes the Shape interface.
Sub-components
Components can be made from other components. The syntax is similar to a top level component, except that everything takes part in the component definition.
component ComplexShape : Shape
{
config:
width1 = Integer;
width2 = Integer;
composition:
square1 = Square(width = width1);
square2 = Square(width = width2);
}
The C++ implementation of the complex component could be something like:
Sub-components help with encapsulation, reducing complexity and improving composability and reusability. For example, imagine a complex sub-system: