A programming language idea: no static code, explicit caller context (Kite)
Marconi
soldate at gmail.com
Sat May 2 14:28:00 UTC 2026
On Saturday, 2 May 2026 at 14:11:07 UTC, H. S. Teoh wrote:
> On Sat, May 02, 2026 at 01:42:11PM +0000, Marconi via T
Thanks — that’s a very good point, especially about lifetime
visibility.
The direction I’m moving towards is that the owner is responsible
for deciding what to do with heap objects.
When an object escapes and is allocated via on_heap, the owner
can keep track of it:
```c
pointer on_heap(int size) {
pointer p = allocator.alloc(size);
heap_objects.add(p); // owner keeps track
return p;
}
```
Then the programmer can decide when to free objects:
delete obj;
Or even clean everything in one place:
```c
void cleanup() {
int i = 0;
while (i < heap_objects.length) {
delete heap_objects[i];
i = i + 1;
}
}
```
So the idea is:
allocation may be implicit, but ownership and lifetime decisions
are explicit and centralized in the owner.
That said, I agree with your concern — the model must make
lifetime clear enough without requiring the programmer to
mentally simulate escape analysis.
Also, I’ve significantly updated the language since this post
(simplified memory model, removed on_delete, refined ownership,
etc.), **and a lot of that came from feedback like yours — thanks
for that** 🙂
I’ve opened a new thread with the current design, it would be
great to continue the discussion there:
Kite: a pretty C with explicit control
More information about the Digitalmars-d
mailing list