Flecha built-in and library API style
Este conteúdo não está disponível em sua língua ainda.
These rules govern APIs supplied to Flecha programs by the language and its
libraries: primitive members, compiler built-ins, the runtime-facing prelude,
and the future standard library. They do not govern ordinary user-defined
Flecha functions, and they do not replace the C++ implementation rules in
CODE_STYLE.md.
For Flecha source formatting in std/, also follow the
standard-library development guidelines.
Member functions
Section titled “Member functions”Member functions use camelCase:
text.len();text.at(0);text.substr(0, 3);text.startsWith("fl");text.string();text.cast<string>;owned.cast<stringv>;An acronym is treated as a word, such as isUtf8() rather than isUTF8().
Generic member forms such as cast<type> follow the same naming rule even
when their syntax does not include parentheses.
Existing language members that are already public API should be migrated to
this convention before compatibility guarantees are introduced.
Free functions
Section titled “Free functions”Built-in and standard-library free functions use snake_case:
stdoutln("ready");read_line();parse_i32("42");string_from_bytes(data);Single-word names naturally remain lowercase, including stdout and
stdoutln. Naming rules for ordinary user-defined Flecha functions are a
separate language-design decision.
Compiler intrinsics and exported runtime C symbols are implementation details.
Their names may follow ABI-specific conventions, such as the existing
flecha_runtime_v1_ snake-case prefix, without exposing those names as the
idiomatic Flecha API.