Hasty Briefsbeta

A proposal to add GC-less, unmanaged memory spaces to C#

4 days ago
  • #Performance
  • #C#
  • #Concurrency
  • Introduces 'Spaces' as a new architectural primitive in C# to unify high-level managed languages and low-level systems languages.
  • Aims to resolve the 'Monolith vs. Microservices' debate by allowing systems to be designed as monoliths but deployed as microservices.
  • Spaces are isolated units of computation with their own memory heap and threads, eliminating concurrency issues like race conditions.
  • Communication between Spaces is through asynchronous message passing, abstracted with new keywords like 'swait' and 'srun'.
  • Supports fine-grained configuration of Spaces via .csproj files, including execution environment (Managed/Unmanaged), compilation (AOT/JIT), runtime (ThreadGroup/Isolate), and transport (SharedMemory/gRPC/NamedPipes).
  • Introduces 'overspace' for contextual polymorphism, allowing types to have different implementations in different Spaces.
  • Proposes a strict 'Airlock' safety model for inter-Space communication, ensuring data is copied but behavior is reconstituted in the destination Space.
  • Ensures backward compatibility by treating existing C# applications as operating within a single implicit 'Default Space'.
  • Requires enhancements to the CLR and Roslyn compiler to support Space lifecycle management, inter-Space communication, and unmanaged execution.
  • Designed as an opt-in feature, with deep IDE integration for context-aware tooling, debugging, and IntelliSense.