Hacker Newsnew | past | comments | ask | show | jobs | submit | overbring_labs's commentslogin

Well, it's in Rust now, thanks to your and someone else's comments! https://github.com/waseigo/disk_space


Holy moly, you weren't kidding. Grok 4 is so much better. Thanks!


Given the amount of issues the code had when I ran splint on the C file, I agree. The question was for me whether I can get something working to get over the "speed bump" of lacking such a function for the API client I'm writing.

I'm now re-vibe-coding it into Rust with the same process, but also using Grok 4 to get better results. It now builds and passes the tests on Elixir 1.14 to 1.18 on macOS and Ubuntu, but I'm still trying to get Grok 3 and 4 to fix the Windows-specific parts of the Rust code.


Amen, thank you for noticing. The goal here was not to produce something of stellar quality, which is anyway out of the question as I don't have the skills/knowledge to evaluate anything other than "it returns the Elixir map I wanted". It was to see if this is feasible at all.


It's just that Grok 3 is faster than 4, so I've set it by default. But point taken, I'll try out the newer ones now that I'm converting it to Rust.


Because what difference would it make, given the bad quality of code?

Also, is Claude Code free to use?

The manual process has the upside that you get to see how the sausage is (badly) made. Otherwise, just YOLO it and put your trust in GenAI completely.

Furthermore, if there is the interim step of pushing to GitHub to trigger the build & test workflow and see if it works on something other than Linux, is the choice of Vibe-Coding IDE really the limiting factor in the entire process?


What is your definition of "a working project"? It does what it says on the tin (actually it probably does more, because splint throws some warnings...)


It's more of "yeah it worked, but I had to do a lot of hand-holding" and "it passes the tests but I cannot tell if the code has memory leaks".

Actually, I can tell; I ran split on the C source and got things like this:

disk_space.c:144:16: Only storage bin.ref_bin (type void *) derived from variable declared in this scope is not released (memory leak)

So I'm looking into a Rust version with Rustler now.


I'd also recommend having a look at the Zig library for Elixir. For simple stuff, you can just inline, but support for pretty complex setups too.

Also comes with a built-in BEAM allocator so the runtime properly reports NIF memory consumption.

https://hexdocs.pm/zigler/Zig.html


Thanks, one day I'll look into Zig too, because I've been impressed with what Tigerbeetle has achieved with it! For now, I'm all-in on Elixir.


you can use zigler for a c nif, using easy_c (or c_src) options.

the big advantage is that it will automatically box/unbox to/from c values for you and generate sane error messages (which rustler does not, last i checked) when you pass incompatible terms in to the function.

on the other hand rustler lets you precompile (which is coming in a future version of Zigler)


I mean, you aren't wrong. I'm looking into converting it into Rust with Rustler right now.


Yep, was wondering why you didn't go down that path in the first place. Seems way safer.


It's because the most familiar thing to me that uses a NIF was Exqlite, so that was my starting point.

Using Rust and Rustler turned out to be way easier and it also now works across Elixir versions 1.14 to 1.18.


Great outcome :)


Truly, way better than before: https://github.com/waseigo/disk_space

And it now runs on everything, across more Elixir and Erlang/OTP versions than before!


You wouldn't ask a rabbi about the New Testament or an imam about the Torah and expect unbiased responses. So why ask a CCP-influenced LLM about things you already know you won't get an unbiased answer to?


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: