Style Guide
Canonical source:
docs/style-guide.md
- One concern per file
- Intent-obvious naming
- Use
mod.sfnfor public API surfaces
Repository Layout
Section titled “Repository Layout”compiler/ # The self-hosted compiler src/ # Compiler source (.sfn) tests/ # Unit, integration, and e2e testsruntime/ # Runtime libraries prelude.sfn # Sailfin-native prelude sfn/ # Sailfin-native runtime modules (clock, memory, process, type_meta, …) native/ # Supporting C helpers (entry point already in Sailfin; M3 retires the rest)docs/ # Language documentationexamples/ # Example programsscripts/ # Build and release toolingtools/ # Developer toolingFile Naming
Section titled “File Naming”- snake_case for all files:
http_client.sfn,effect_checker.sfn - Role suffixes:
*_utils.sfn,*_checker.sfn,*_lowering.sfn,*_ir.sfn,*_semantics.sfn mod.sfnfor module public API re-exports
Sailfin Code Style
Section titled “Sailfin Code Style”CamelCasefor types:UserProfile,HttpResponsesnake_casefor functions and variables:fetch_data,user_countUPPER_SNAKE_CASEfor constants:MAX_RETRIES- Effect annotations on same line:
fn save(data: string) ![io] { - Doc comments with
///
Import Conventions
Section titled “Import Conventions”- Relative imports within a module folder
- Cross-domain imports via
mod.sfn
Documentation Updates
Section titled “Documentation Updates”When changing language behavior, update in order:
docs/status.md— What ships today- Language spec under
site/src/content/docs/docs/reference/spec/(shipped) or.../reference/preview/(planned) - The roadmap — If it affects planned work