E1862: dynamic call without a closed set of implementations

View source

A meta stack_limit verb needs a bound for every call it makes (ADR-0103).

A meta stack_limit verb needs a bound for every call it makes (ADR-0103). A call through a dynamic role value can reach any implementation of the method, so the bound is only known when the program has its implementations and they are all visible. The compiler reports this error when it finds no perform of the called role that defines the method; a perform of another role with a method of the same name does not count. The error points at the call and names the method.

Example

actus
role Writer {
    verb write(abs self: Int) -> Int;
}

meta stack_limit(bytes: 256u32)
verb send(abs writer: dynamic Writer) -> Int {
    return write(self: abs writer);
}

verb main() {
}

Fix

Implement the role with a perform block, so the set of implementations is known to the compiler.

actus
struct File {
    value: Int,
}

role Writer {
    verb write(abs self: File) -> Int;
}

perform Writer for File {
    verb write(abs self: File) -> Int {
        return self.value;
    }
}

meta stack_limit(bytes: 256u32)
verb send(abs writer: dynamic Writer) -> Int {
    return write(self: abs writer);
}

verb main() {
}
toml
[package]
name = "example"
version = "0.1.0"
edition = "alpha"
entry = "main"

[build]
target = "x86_64-unknown-linux-gnu"
profile = "debug"
runtime = "std"

Run actus explain E1862 in your terminal to read this entry offline. Browse Strict & toolchain or all error codes.