28 lines
630 B
Markdown
28 lines
630 B
Markdown
# Composition Expression
|
|
|
|
A composition expression combines multiple values, constraints, or structures.
|
|
|
|
## `&`
|
|
|
|
`&` performs constraint-preserving composition.
|
|
|
|
```dcdl
|
|
Port = Int & >= 1 & <= 65535;
|
|
Config = MyConfig & { port = 8000; };
|
|
```
|
|
|
|
Because object fields present on only one side are retained, `&` has no direction.
|
|
Use [`as`](./ascription.md) to verify that the left side is narrower than the right and treat the right side as the field domain.
|
|
|
|
## `//`
|
|
|
|
`//` performs a right-biased structural patch.
|
|
|
|
```dcdl
|
|
Patched = Base // {
|
|
feature_hoge.enable = false;
|
|
};
|
|
```
|
|
|
|
See [Operators](../operators.md) for details.
|