Docs menu

E137: A function can't be used as a value here

What compiler error E137 means, and how to fix it.

A function used as a value is written by its bare name: mut f: fn(int): int = twice;. A qualified name such as io::printline or Point::origin is only ever called, with parentheses and arguments:

Example
import io;mut f: fn(string): void = io::printline;   // a qualified name is not a valueio::printline("hello");                     // a call: this runs it

To use a module’s function as a value, import it by name and write the bare name:

Example
import helper::twice;mut f: fn(int): int = twice;

A static method (Point::origin) has no value form. Wrap the call in a plain function and use that function’s name:

Example
fn origin(): Point { return Point::origin(); }

An @caller_location function is not a value either (only a direct call passes the location). Wrap the call in a plain function the same way.

A generic function is a value only where a function type says what its type parameters are:

Example
fn<T> id(x: T): T { return x; }mut g = id;                       // E137: nothing says what T isimmut f: fn(int): int = id;       // fine: T is int

Run turf --explain E137 in a terminal to read this again.

Last updated: Oct 15, 2026Edit this page on GitHub

Esc

Type to search.