OxL Справочник OxL
РусскийEnglish

error effects

error Стандарт: [§6.2]

Вызов функции с недопустимым эффектом.

What it means#

A function may call only functions whose effects are contained in its own effect set (§6.2). Effects of private functions are inferred, so the error appears where the set is fixed: a function that declares its effects (including pure), a pub(api) function, comptime code (§15.1), or a function-typed parameter.

Example#

oxl✓ проверяется в CI
fn calc() -> i32  pure {
  sleep(1s)      // <- effects (sleep needs `time`)
  42
}
error
effects

How to fix#

oxl✓ проверяется в CI
fn calc() -> i32  time {
  sleep(1s)
  42
}

Add the missing effect to the signature, or remove the call. Effect-polymorphic helpers (effect F) let callers decide the set.

See also#

OxL 1.0.0-beta · Версия документации 1.0.0-beta© OxwaldLink · сгенерировано из Стандарта, исходников std и руководства