Skip to content

Commit daf7103

Browse files
committed
Improvements
1 parent b22e287 commit daf7103

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

usage/submodels/index.qmd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,19 @@ In the case of the `family_model`, we do not care about its return value because
265265
Ideally, we should therefore not need to place anything on the left-hand side of `to_submodel`.
266266
However, because the special behaviour of `to_submodel` relies on the tilde operator, and the tilde operator requires a left-hand side, we have to use a dummy variable (here `_n`).
267267

268+
Furthermore, because the left-hand side of a tilde-statement must be a valid variable name, we cannot use destructuring syntax on the left-hand side of `to_submodel`, even if the return value is a NamedTuple.
269+
Thus, for example, the following is not allowed:
270+
271+
```julia
272+
(; c0, c1, mu) ~ to_submodel(priors(x))
273+
```
274+
275+
To use destructuring syntax, you would have to add a separate line:
276+
277+
```julia
278+
ps = to_submodel(priors(x))
279+
(; c0, c1, mu) = ps
280+
```
268281

269282
## Submodels versus distributions
270283

0 commit comments

Comments
 (0)