E1089: dynamic parameter must be abs

View source

A parameter of the form dynamic Role receives any value that performs the role, through a pointer that the callee does not own (ADR-0014).

A parameter of the form dynamic Role receives any value that performs the role, through a pointer that the callee does not own (ADR-0014). The callee therefore may only look at it, and the parameter must use the abs role. erg, dat and ins would let the callee own, consume or change a value whose type it does not know. The message names the parameter. The error points at the parameter.

Example

actus
struct Cursor {
    position: Int,
}

role Reader {
    verb read(abs self: Cursor) -> Int;
}

verb pull(erg source: dynamic Reader) -> Int {
    return 0;
}

verb main() {
}

Fix

Declare the parameter abs.

actus
struct Cursor {
    position: Int,
}

role Reader {
    verb read(abs self: Cursor) -> Int;
}

verb pull(abs source: dynamic Reader) -> Int {
    return 0;
}

verb main() {
}

Run actus explain E1089 in your terminal to read this entry offline. Browse Ownership & types or all error codes.