E1124: deterministic code calls a nondeterministic verb

View source

A verb marked meta deterministic must give the same result for the same input.

A verb marked meta deterministic must give the same result for the same input. It may not call a verb with the effect filesystem, network or entropy, because these read the outside world (ADR-0092). The error points at the call. The message names the callee and the effect.

Example

actus
meta effect("entropy")
verb noise() -> Int {
    return 4;
}

meta effect("entropy")
meta deterministic
verb stable() -> Int {
    return noise();
}

verb main() {
}

Fix

Pass the value in as an argument, so the caller decides where it comes from.

actus
meta effect("entropy")
verb noise() -> Int {
    return 4;
}

meta deterministic
verb stable(erg seed: Int) -> Int {
    return seed;
}

verb main() {
}

Run actus explain E1124 in your terminal to read this entry offline. Browse Modules & rules or all error codes.