OxL Reference

6.2 Effects

EffectWhat it permits
iofiles, processes, environment variables, stdout/stderr
netnetwork: rpc, streams, actors, cluster, HTTP
dbORM, std.kv, the built-in storage
timereading clocks, sleep, timers
randrandom numbers
  • The set of effects is written after the return type, comma-separated: -> User | NotFound net, db. pure is the empty set.
  • A function MAY call only functions whose effects are included in its set. A violation is a compile error.
  • The effects of private functions are inferred. pub(api) functions MUST declare their effects explicitly (or pure).
  • Effect polymorphism: fn map<T, U, effect F>(xs: List<T>, f: fn(T) -> U F) -> List<U> F.
  • A panic is not an effect and is possible in any function.
  • A function with any of the effects io, net, db, time is suspendable: it may yield the thread to the scheduler (§8.2). pure and rand functions do not suspend.

effects

See also

Source: docs/spec/oxl-standard.en.md