DLLM - D Language 🤖 on 🦙.cpp
Meta
jared771 at gmail.com
Thu Mar 26 11:28:19 UTC 2026
On Tuesday, 24 March 2026 at 21:02:34 UTC, Danny Arends wrote:
> Lol, no I made it to learn low level llama.cpp and use importC.
> It was fun figuring out how to generate everything surrounding
> agentic tools by using UDAs with __traits. My normal projects
> generally don't use a lot of meta programming and reflection.
>
> However, the current version can read and "understand" it's own
> codebase with just an 8B model. So you could put it in a vibe
> loop to recursively improve itself. Just remove the limitations
> on writing to the workspace/ folder and see what it'll do.
Damn, that's really cool. I noticed that a lot of your tools
followed this pattern:
```d
@Tool("Count how many times substring appears in text.")
string nOccurrences(string text, string substring) {
try {
return to!string(text.count(substring));
} catch (Exception e) { return(format("Error: %s", e.msg)); }
}
```
Did you know that you can use
[std.exception.ifThrown](https://dlang.org/library/std/exception/if_thrown.html) to simplify this down to:
```d
@Tool("Count how many times substring appears in text.")
string nOccurrences(string text, string substring) {
return text.count(substring)
.to!string()
.ifThrown(e => "Error: %s".format(e.msg));
}
```
I love how you can write such elegant, concise code in D.
More information about the Digitalmars-d-announce
mailing list