E1019: owner initialized from a view

View source

An erg binding owns its value.

An erg binding owns its value. Initializing it from an abs binding would make a second owner of a value that the view does not own. Actus never copies implicitly (ADR-0059), so the compiler rejects this. The error points at the declaration.

Example

actus
verb copy_of(abs a: Int) -> Int {
    erg b: Int = a;
    return b;
}

verb main() {
}

Fix

Scalar values can be reused with an explicit copy of an abs view. For a buffer or a resource, use the view itself or let the caller transfer ownership with dat.

actus
verb copy_of(abs a: Int) -> Int {
    erg b: Int = copy(value: abs a);
    return b;
}

verb main() {
}

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