HN
Today

CobaltC – The Successor to C?

CobaltC emerges as a meticulously detailed specification for a new systems programming language, aiming to blend C-like performance with Rust's robust memory safety features like ownership and borrowing. The Hacker News community is quickly dissecting its design principles, noting strong resemblances to Rust and other modern languages, leading to discussions about originality and the feasibility of such a comprehensive specification. This story taps into the perpetual HN fascination with language design and the quest for safer, more efficient systems programming paradigms.

6
Score
6
Comments
#6
Highest Rank
2h
on Front Page
First Seen
Aug 31, 3:00 AM
Last Seen
Aug 31, 4:00 AM
Rank Over Time
610

The Lowdown

CobaltC is presented as a statically typed systems programming language, meticulously documented in a 92-section specification. Its core mission is to provide predictable resource management, strong memory safety, and native execution capabilities, all while avoiding garbage collection and offering controlled interaction with low-level facilities. The specification details a language designed with safety and performance at its forefront, clearly drawing inspiration from advancements in modern language design.

  • Core Safety Mechanisms: Emphasizes explicit ownership, deterministic destruction, compiler-checked borrowing, and inferred lifetimes to ensure memory safety without a garbage collector.
  • Type System: Features static typing with explicit nullability, primitive types (i8-i128, u8-u128, f32/f64), and compound types including structs, enums, tuples, arrays, and generic types.
  • Concurrency: Includes explicit support for safe concurrency through standard primitives like Mutex, RwLock, Atomic, and Channel, preventing data races in safe code.
  • Error Handling: Adopts a Result<T, E>-based structured error handling model and a ? operator for propagation, eschewing exceptions.
  • Unsafe Operations: Provides unsafe blocks for low-level operations, explicitly delineating safe and unsafe boundaries while ensuring safe abstractions over unsafe code.
  • Detailed Specification: The document goes into extensive detail on everything from lexical elements and syntax to memory model, ABI profiles, runtime requirements, and conformance levels.

In essence, CobaltC seeks to be a high-performance systems language that builds on modern safety paradigms, promising a rigorous, compiler-enforced approach to memory management and concurrency, while aiming for source and binary compatibility through well-defined ABI profiles.

The Gossip

Rust's Kinship and Copying Claims

Many commenters immediately pointed out the striking similarities between CobaltC's features and Rust's, particularly its ownership model, borrowing, explicit nullability via `Option`, and error handling via `Result`. Some playfully suggested CobaltC copied 'Rust's homework,' while others viewed it as an evolution or a clear adoption of proven modern language design principles, acknowledging that Rust itself built upon earlier concepts like those from Haskell.

Specification Scrutiny and Implementability Concerns

A significant theme revolved around whether the document was a concrete language specification or merely a 'wishlist.' While acknowledging that all specs delegate some details to implementation, critics noted that critical sections, especially on borrowing and lifetimes, were remarkably concise, lacking the depth needed to truly define novel behavior or differentiate from existing implementations like Rust's NLL or Polonius. This led to questions about the practical implementability of such a detailed yet occasionally vague specification.

Alternative 'C Successors' and Market Crowding

One comment directly asked for a comparison to C3, another language positioned as a potential 'successor to C.' This highlighted a broader sentiment on HN: the space for new systems programming languages is increasingly crowded, and any new entrant needs a clear, compelling differentiator beyond simply combining existing best practices.