Components
This framework offers component based development. Components comes at various level of the development and can be associated to become a larger component. Components can also contains sub-components. It defines a composable entity which roles can vary from a driver to a functional component.
A component contains 2 entities, an interface, that is shared between all components of the same type and an implementation specific configuration.
For example, we will define a square which 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 border width. Such 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 helps for encapsulation and hence reduce the complexity and composability while improving re-usability. For example, imagine a complex sub-system: