E1022: verb name reserved for an intrinsic

View source

Some names belong to built-in intrinsics: allocate, append, buffer_length, copy, crc32, crc32_matches, validate_fixed_frame, drop, place, raw_slice, size_of, align_of and the co...

Some names belong to built-in intrinsics: allocate, append, buffer_length, copy, crc32, crc32_matches, validate_fixed_frame, drop, place, raw_slice, size_of, align_of and the console calls print, eprint, println, eprintln and flush. A program cannot declare a top-level verb with one of these names, with or without a self parameter, because the call would mean another action than the one the language defines (ADR-0134, REQ-TYPE-0014, REQ-TYPE-0017). A method declared inside a perform or role block may carry the name, because it is called with self: and is chosen by the role. The error points at the declaration.

A free verb named drop is rejected the same way. Cleanup has exactly one form, perform Drop for T { verb drop(ins self: T) { ... } } (ADR-0027), and the message names that form with the real type when the signature is ins self: T.

Example

actus
verb buffer_length(abs value: Int) -> Int {
    return copy(value: abs value);
}

verb main() {
}
actus
struct Counter {
    count: Int,
}

verb drop(ins self: Counter) {
}

verb main() {
}

Fix

Choose another name, or write a cleanup as a perform Drop block.

actus
struct Counter {
    count: Int,
}

perform Drop for Counter {
    verb drop(ins self: Counter) {
    }
}

verb main() {
}
actus
verb length_of(abs value: Int) -> Int {
    return copy(value: abs value);
}

verb main() {
}

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