Hasty Briefsbeta

Bilingual

Odin: Moving Towards a New "core:OS"

4 months ago
  • #Odin
  • #Programming
  • #API Design
  • Odin is designed to be pragmatic and evolutionary, with a focus on stability and minimal breaking changes.
  • Packages `base:runtime` and `core:os` are the oldest in the core library, with `core:os` needing a redesign due to poor API design and inconsistencies across platforms.
  • A new version of `core:os` (currently `core:os/os2`) is being developed with improved standards, and the transition is planned for Q1 2026.
  • Key changes in the new design include explicit allocators for procedures returning allocated memory, use of `^os.File` instead of raw file handles, and consistent APIs across platforms.
  • The rationale for using `^os.File` includes better support for overriding/intercepting behavior and streamlined file buffering.
  • Explicit allocators clarify the distinction between user-level and OS-level allocations, with internal allocators used for OS-level operations.
  • Examples of changes include new error handling with `os.Error`, removal of OS-specific procedures, and improved file handling.