E1154: call of a console verb that `std::io` no longer declares

View source

The console has one API: print, println, eprint and eprintln, each taking one labelled value, and flush() (ADR-0084).

The console has one API: print, println, eprint and eprintln, each taking one labelled value, and flush() (ADR-0084). println and eprintln write the value followed by a newline. print and eprint write exactly the bytes of the value and no newline, for every label. std::io used to declare console verbs that repeated these actions with a Result; they are removed. E1154 reports a call that still names one of them, so that the program moves to the console call that replaces it. The error points at the whole call.

The error is temporary. It stays in the 0.3.x releases and is retired in 0.4.0.

These calls are reported, however io is imported or qualified:

The unlabelled calls print(x) and eprint(x) are reported too. In the step A release they wrote a newline; print and eprint now do not. The fix writes println(LABEL: x) or eprintln(LABEL: x) with the label of the type of x (string, int, buffer or bool; a buffer stays print, because it never wrote a newline).

The verb is recognized by the name and by the module it is written through (io::println, an alias of the module, or the bare name while a module named io is imported). A bare eprint(buffer: b), eprintln(buffer: b) and flush() are the console calls themselves and are not reported. The console calls print, eprint, println and eprintln are not reported with a label: a program written for the earlier form print(string: s), which ended the line, must be migrated to println before this release; from this release print(string: s) writes no newline.

Example

actus
import std::io;

verb main() -> Int {
    erg text: String = "ready";
    io::println(text: abs text);
    return 0;
}
actus
import std::io;

verb main() -> Int {
    io::flush();
    return 0;
}

Fix

Write the console call of the table. actus check --format json offers this as a fix, and actus fix applies the safe ones. The fix is safe when the call is a statement that drops its Result. The console calls have no value, so it is review when the Result is used (?, a binding, an argument, a case subject or a return), and a person decides what replaces that value.

actus
verb main() -> Int {
    erg text: String = "ready";
    println(string: abs text);
    return 0;
}
actus
verb main() -> Int {
    print(string: "ready");
    flush();
    return 0;
}

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