orangeduck/Cello logo

orangeduck/Cello

Free

Higher level programming in C

FreeFree tier
Type
Open Source

About orangeduck/Cello

Cello is an open-source C library that introduces higher-level programming constructs to the C language. It acts as a modern, powerful runtime system, enabling features such as generic data structures, polymorphic functions, interfaces/type classes, constructors/destructors, optional garbage collection, exceptions, and reflection. Cello works seamlessly alongside standard C, allowing developers to benefit from C's performance and tooling while using more expressive abstractions. The library includes stack and heap object creation, collection iteration, and compatibility with standard C types. It is primarily an experimental project exploring the limits of C, but it also serves as a practical toolkit for prototyping and learning.

Key Features

Generic data structures
Polymorphic functions
Interfaces and type classes
Constructors and destructors
Optional garbage collection
Exception handling
Reflection capabilities
Stack and heap object creation
Collection iteration (foreach, range, slice)
Seamless integration with standard C

Pros & Cons

Pros
  • Brings modern high-level concepts to a low-level language
  • Seamless coexistence with standard C code
  • Optional garbage collection reduces manual memory management
  • Supports reflection and exception handling
  • Open-source and free to use
  • Includes extensive documentation and examples
Cons
  • Experimental project, not recommended for production use
  • May introduce runtime overhead compared to plain C
  • Requires learning Cello's runtime conventions and types
  • Limited community and ecosystem compared to mainstream C++ or Rust
  • Potentially steep learning curve for C purists

Best For

Adding high-level abstractions to C projectsPrototyping and experimenting with C programsEducational exploration of C's capabilities and limitsBuilding libraries that benefit from runtime polymorphismQuickly writing C code with reduced boilerplate

FAQ

Why does Cello exist?
It was created as a fun experiment to see what C looks like when hacked to its limits, serving both as a powerful library and as an exploration of C's possibilities.
How does Cello work?
Cello uses a fat pointer technique to implement its runtime system, allowing objects to carry type information and enabling features like reflection, polymorphism, and garbage collection.