Kite: a pretty C with explicit control

Marconi soldate at gmail.com
Sat May 2 14:10:29 UTC 2026


Hi all,

I’ve been refining an idea for a language called Kite.
The goal is simple:

Make C cleaner without hiding control.

Kite is designed for people who like C, but want clearer 
structure and fewer hidden traps.

🔹 What makes Kite different

mytype myobj;
→ always valid (non-null)
→ compiler decides: stack or heap

Heap vs stack is not your problem
→ the compiler handles allocation

Freeing memory is your problem
delete obj;

→ if you forget: memory leak (by design)

🔹 Pointers are explicit
pointer mytype p;
can be 0
can do pointer arithmetic
full control, full risk

Safe by default. Unsafe when you ask for it.

🔹 Errors don’t pollute the code

throw "file not found";

stops execution immediately
goes to a single place:

void on_error(string e) {
     console.write(e);
}

Write for success. Handle failure in one place.

🔹 Philosophy
no garbage collector
no hidden allocation
no implicit behavior
no “safety theater”

Kite separates allocation from lifetime.

allocation → compiler
lifetime → programmer

🔹 One line

Kite is C, but cleaner, more explicit, and focused on the happy 
path.

Curious to hear thoughts.


```java
import kite.io.file;

type node {
     int value;
     pointer node next; // manual pointer, can be 0 (null)
}

type file_reader {
     string read(string path) {
         file f = owner.fs.open(path);

         if (f == 0) {
             // throws error, does NOT return
             // control jumps to owner.on_error(...)
             throw "file not found";
         }

         return f.read_all();
     }
}

type list {
     node head;

     void add(int v) {
         node n;
         // n is created here
         // if it does NOT escape this scope → stack
         // if it escapes (like below) → heap via owner.on_heap()

         n.value = v;

         // n escapes here because it's stored in a field
         // compiler promotes it to heap
         // owner.on_heap(...) is called internally
         n.next = head;
         head = n;
     }
}

type app {
     pointer on_heap(int size) {
         // called when an object needs to go to heap
         return allocator.alloc(size);
     }

     void on_error(string e) {
         // central error handling
         console.write("error: " + e);
     }

     void main() {
         list l;

         l.add(10);
         l.add(20);

         node current = l.head;
         // current is a reference (never null)

         while (current != 0) { // pointer comparison
             console.write(current.value);

             current = current.next;
         }

         // Example of object lifetime:

         node temp;
         temp.value = 42;
         // temp does NOT escape → stays on stack
         // automatically destroyed when leaving scope

         node leaked;
         leaked = l.head;
         // leaked references a heap object (because it escaped 
earlier)

         // heap objects must be freed manually
         delete leaked;
         // if not deleted → memory leak (by design)
     }
}
```


More information about the Digitalmars-d mailing list