A programming language idea: no static code, explicit caller context (Kite)
Marconi
soldate at gmail.com
Fri May 1 01:57:57 UTC 2026
Hi all,
After the previous discussion, I’ve refined the idea quite a bit
and changed direction in some important aspects. I think it’s
easier to explain Kite by showing code instead of describing it
abstractly.
The core idea is now:
No hidden behavior. No runtime magic. The programmer owns
everything.
Instead of GC, exceptions, or implicit allocation, Kite uses
ownership hooks defined at the top level.
🔹 Top-level owner (the root of responsibility)
```java
type app {
ptr on_new(int size) {
return allocator.alloc(size);
}
void on_delete(ptr p) {
allocator.free(p);
}
void on_error(string e) {
console.write("error: " + e);
}
void main() {
file_reader r;
string text = r.read("config.txt");
console.write(text);
}
}
```
on_new → called whenever heap allocation is needed
on_delete → called on deallocation
on_error → called when throw is executed
No GC. No hidden allocation. No implicit exception handling.
🔹 A regular type
```java
type file_reader {
string read(string path) {
file f = owner.fs.open(path);
if (f == null) {
throw "file not found";
}
return f.read_all();
}
}
```
Important points:
owner is always available
it represents the responsible context (not just the caller)
throw "..." does not search for a random catch block
Instead:
it routes directly to the nearest owner.on_error(...)
🔹 Allocation model (the “bold” part)
```java
type node {
int value;
node next;
}
node n;
```
Here’s the key idea:
the compiler tries to place n on the stack
if it escapes (returned, stored, etc.), it is moved to the heap
when that happens, it calls:
owner.on_new(...)
So:
allocation is not implicit — it is owned
🔹 Error model
Errors are not values, and not part of the type system.
throw "file not found";
interrupts the current flow
does not return
does not require boilerplate
is handled centrally by the owner
This keeps the code focused on the success path:
string text = r.read("config.txt");
No noise. No wrapping. No propagation boilerplate.
🔹 Design principles (updated)
No global state (everything belongs to an owner)
No garbage collector
No hidden allocation
No implicit exception system
No forced “safe” model
Instead:
Kite gives full control — and full responsibility — to the
programmer.
🔹 One-line summary
Kite is a C-like language where memory and errors are handled by
explicit ownership hooks instead of runtime magic.
I’m still exploring trade-offs (especially around implicit stack
→ heap promotion and performance), but I think this direction is
much clearer.
Curious to hear thoughts — especially what breaks in this model.
More information about the Digitalmars-d
mailing list