Hey folks, new project(s) up! Dmon. It's a port of a C library to pure Nim.
Hey guys, for Figuro I wanted a file watcher. Unfortunately all the previous attempts I could find were partially done or just wrappers around libraries or programs. So I decided to try using LLMs to help me port some to a Nim library. That was an interesting experience so I wrote about it for those curious about it. I'd recommend trying Claude for porting code to Nim.
However I've only gotten MacOS and Linux running and tested. I've started porting Windows, but I don't have access to Windows and not sure I wanna pay for a VM just for this. I might try compiling it with Wine.
Anyone interesting in helping with the Windows port? We'd finally have a native Nim file watcher supporting all the big OS'es. Also, porting BSD kqueue would be awesome too, but I probably won't have the time.
Okay, I got the Windows version compiling!
Unfortunately I can't get it to run under wine on my ARM machine.
It should feasible to get it running with less than an hour of testing and tweaking. Mainly it's just verifying the data structs / pointer stuff is done right and is printing the right data. For example I had an issue on Linux where I just had to tweak the recursive dir handling.
I believe the issue with ChatGPT is that they lie about the model that is offered in the free tier. I can tell there's a difference between the one used for benchmarks in https://lmarena.ai/ and the one I have access in my account.
Ha, I wouldn't be surprised. Though I did have the pro ChatGPT for a while, but I didn't try coding too much with it after it hallucinated some C++ code. To be fair C++ syntax makes me hallucinate as well.
Ultimately it seems the limited context window size in the ChatGPT models hurts it for programming related tasks. It's crazy how big Claude's context windows is compared to GPT 4.
Claude is also strangely very hit or miss sometimes, but for me the subscription was worth it. There was an issue in the previous generation that translated code was changed ever so slightly, it appeared as correct but it wasn't.
Funny, and it was interesting too that Claude translated the code for each OS in slightly different ways. I helped it out by running the C pre-processor for each OS. On one port it didn't include the Dmon prefix, another it did. It also seemed to vary the amount of Nim idioms it used. Makes me wonder if the target OS also affects it's output.
It's sorta sad you can't upgrade or buy more Claude time. I'd totally try wiring it into c2nim directly to automate bits of translation and run a continuous generate-compile loop. Come back in a day or two and maybe have a fully working port of something. It'd probably only cost $20k in compute. ;)
automate bits of translation and run a continuous generate-compile loop. Come back in a day or two and maybe have a fully working port of something. It'd probably only cost $20k in compute. ;)
That sounds like a great project. Btw small LLMs are okay-ish in translating nim code. Nothing as good as Claude, but maybe you can get one of the small ones like ministral-3b running locally with Ollama.