Skip to content

Code Style and Naming

This document defines the default naming and style rules for Beskid source code.

Primary goal: C#-style readability with consistent naming across language, stdlib, and tooling.

Use PascalCase for:

  • type names
  • enum names
  • enum variants
  • contract names
  • generic type parameters (single or short names like T, TItem, TResult)

Examples:

pub type HttpClient {
string BaseUrl,
}
enum Result<TValue, TError> {
Ok(TValue value),
Error(TError error),
}
contract Disposable {
unit Dispose();
}

Use C# conventions:

  • PascalCase for function and method names
  • camelCase for parameters and local variables
  • PascalCase for module-level public value-like constants

Examples:

pub string FormatError(string errorCode) {
let message = "Unexpected error";
return message;
}
unit WriteLine(string text) {
IO.Println(text);
}

Use PascalCase for namespace/module path segments.

Examples:

  • IO
  • Collections
  • Hashing

Avoid mixed casing styles within a namespace chain.

Follow C#-style acronym handling:

  • Two-letter acronyms are all caps in PascalCase: IOStream.
  • Longer acronyms are treated as words: HttpClient, JsonWriter, Utf8String.

For camelCase, lowercase the first letter only:

  • httpClient
  • jsonWriter

Use C#-style names on disk as well (no snake_case):

  • PascalCase for files that define primary public symbols
  • PascalCase for directories representing namespaces

Examples:

  • HttpClient.bd
  • StringBuilder.bd
  • Collections/
  • Default to private symbols.
  • Mark only stable, intended API surface as pub.
  • Keep implementation helpers private to reduce accidental coupling.
  • Do not use a mandatory Std namespace prefix for public APIs.
  • Public type names: PascalCase.
  • Public function and method names: PascalCase.
  • Public module segments: PascalCase.
  • Avoid abbreviations unless standard (utf8, http, json).

Tooling should eventually provide opt-in lints:

  • non_pascal_case_type
  • non_pascal_case_function
  • non_camel_case_variable
  • non_pascal_case_module

These should start as warnings and be promotable to errors in CI.