Identifiers

Identifiers are the names you use throughout WCL — for fields, types, block kinds, block labels, variants, symbols, let bindings, and imported items. The lexical rule is the same everywhere, with one convenience exception for block labels (see below).

Lexical rule

An identifier starts with an ASCII letter (az, AZ) or an underscore (_), and continues with letters, digits, or underscores. No Unicode, no dashes, no spaces.

name           // ok
my_field       // ok
_internal      // ok
v2             // ok
HTTPStatus     // ok

2nd_attempt    // NOT ok — must not start with a digit
kebab-case     // NOT ok as a field/type name — dashes aren't identifier chars

Block labels: kebab-case and paths

Block labels (the name after a block kind) are the one place a bare identifier may contain - and / connectors — so kebab-case class names and path-like page names need no quoting. The connector must sit directly between name parts (no surrounding spaces).

class dgm-box {}              // kebab-case, bare
class wdoc-series-1 {}        // trailing number is fine
page reference/intro {}       // path-like
page api/v1/users {}

class "dgm-box" {}            // quoting still works (and is left as-is by `wcl fmt`)

Reserved words

A handful of words are reserved by the lexer and cannot be used as identifiers in any position:

ReservedUsed for
true, falseBoolean literals
noneThe none literal
if, else, matchControl flow

Other words that look special — type, interface, union, symbol_set, let, import, connection, fn, extends, as — are recognised only in declaration positions, so they may also appear as ordinary identifiers in field names or expressions. Avoid relying on that: it reads more clearly when these names are kept for their declaration use.

Where identifiers appear

PositionExample
Field nameport in port = 8080u32
Type nameService in type Service { … }
Block kindservice in service "web" { … }
Variant nameCircle in Shape::Circle { … }
Symbol nameamber in :amber
let bindingbase_port in let base_port = …
Imported file's itemsTypes and lets from import "./x.wcl"

Naming conventions

The standard library and these docs follow Rust-like conventions, but the language doesn't enforce them. Pick a style and stay consistent within a codebase.

ConventionUsed for
snake_caseFields, let bindings, block kinds, symbols
PascalCaseTypes, interfaces, unions, variants, symbol sets
SCREAMINGRarely; reserve for visibly-constant globals