Skip to main content

L1335 - Native Record Field Not Initialized

Error

-module(main).
-export([new/1]).
-record(#point {x, y}).
new(V) -> #point{x = V}.
%% ^^^^^^^^^^^^^ error: field y is not initialized in native record point

Explanation

The error occurs when a local native record (EEP-79) is created without giving a value to every field that has no default.

Unlike tuple records, a native record does not silently fill omitted fields with undefined: each field that has no default value must be initialized explicitly at the creation site. To fix the error, provide a value for the missing field (here y), or give the field a default value in the record definition.