# E4050

Definition cycle detected in dependencies.

The toplevel definitions in a MoonBit package are mutually recursive. This means
that the definitions can refer to each other in any order. However, no cycles
are allowed in the dependencies between the toplevel variable definitions.

## Erroneous example

```{literalinclude} /sources/error_codes/E4050_error/top.mbt
:language: moonbit
```

## Suggestion

The fix to this error varies depending on the logic of the program. One possible
fix is to make the variable definition to use `Ref[_?]`, and initialize the
variable later in `init` block of the program.

```{literalinclude} /sources/error_codes/E4050_fixed/top.mbt
:language: moonbit
```
