Luce / engineering
Learn Luce LuciaOS

The language through an engineer's eyes

Choose a feature you already recognize—variables, numbers, classes, errors, or threads. Each chapter starts with a small program, follows it through Luce’s MIR and LLVM IR, and ends at the ARM64 object code.

How to read this section

Read the first few paragraphs for the idea. Open the four-view trace to see its lower-level representation. Continue below it for edge cases, memory behavior, and implementation source.

Feature map

  • Bindings and assignment — let, var, annotations, zero values, weak places, compound and parallel stores
  • Numbers — explicit widths, contextual literals, checked integers, IEEE floats, bit operations, conversions
  • Text and bytes — Unicode scalars, UTF-8 strings, binary values, interpolation, builders
  • Control flow — conditions, loops, matching, narrowing, early exits, recursion
  • Functions and methods — named/default arguments, multiple results, receiver effects, values, binding, closures
  • Structures — value layout, memberwise construction, defaults, methods, copy behavior
  • Classes — final identity, ARC, initialization, shared mutation, weak edges, deinitialization
  • Interfaces — explicit conformance, method tables, owned payloads, and mutating struct implementations
  • Enums and unions — closed alternatives, tagged payloads, exhaustive matching, recursive finiteness
  • Absence and failure — T?, T!, try, catch, traps, traces
  • Collections — lists, maps, arrays, builders, slices, element ownership
  • Program structure — modules, imports, packages, visibility, constants, aliases
  • Concurrency — isolated workers, copied graphs, ARC tasks, structured joins
  • Host effects — entry, console, files, clocks, processes, terminal, network, UI/GPU

How to inspect any feature

A feature cross-sectionOne feature crosses each of these layers

The rule beneath the surface

Values copy. References share identity. ARC keeps references alive. Weak references break cycles. Resources close at the last strong release. Workers communicate by copying values between separate heaps.

This rule predicts behavior across arguments, returns, fields, optionals, unions, interfaces, closures, containers, and tasks. Each feature applies the same ownership model to a different kind of storage.

Static decisions, dynamic consequences

Compile time

Every expression has one type. Calls, labels, visibility, conformance, mutation, worker transfer, possible errors, capture kind, and return coverage are decided before MIR.

Run time

Checked arithmetic may trap, references retain and release, virtual interface slots dispatch, containers enforce bounds, resources touch the host, and workers copy graphs.

How the feature set shapes the implementation

Conversions are explicit calls, conditions use bool, structs carry values, classes carry identity, ARC manages references, and workers exchange copied values. These choices determine the type checker, MIR vocabulary, runtime data structures, and generated checks. The decisions section follows those consequences in detail.