by rs186 · 1y ago · 0 comments
Also, my personal experience with LLMs fixing compilation errors is: when it works, it works great. But when it doesn't, it's so clueless and lost that it's a complete waste of time to employ LLM in the first place -- you are much better off debugging the code yourself using old fashioned method.
Which at least with Cursor's implementation means that it by default gives you the last iteration of its attempt to fix the problem, which when this happens is almost always way worse than its first attempt.
"Sure! Let me...." (writes the most ungodly garbage Rust known to man)
Now, I certainly hope I'm wrong. It would be nice to enjoy similar benefits to guys doing more python/typescript work. I just doubt it's that good.
No need to be envious: it doesn't give me compilation errors in python, but that ain't because it always gives correct code!
(It can be helpful too, but I get a lot of hallucinated APIs/arguments/etc.)
Then once you start reaching for a bit more complex problems (like ffi, or building your own lib), llms are actually making waste time spitting nonsense.
However, once your patterns are back on track, and you start to know a bit better what you're doing, you can easily dismiss those bad advices, and immediately give the llm hints that will make them useful again.
At least that's my experience.
I'm not sure. I've begun advocating for people, when they write blogposts etc., to dump and attach their conversations (unless precluded by security/privacy) so those of us who seem to get worse results can see if there are "tricks" or styles to it we miss. If you're amenable to it, this would be doubly helpful from someone who knows the language so extremely well!
Usually when you come to an LLM with an error like this it's because you tried something that made sense to you and it didn't. Turns out those things usually "make sense" to an LLM, too, and they don't step through and reason through the "logic", they just vibe off of it, and the pattern they come back to you with is usually just some variant of the original pattern that led you to the problem in the first place.
LLM was able to connect the dots of some more complex and rarer Rust features and my requirements. I did not know that they could be used like that. One case was, for example, about complex usage of generic associated types (GATs).
What it comes to lifetime issues, usually it is about wasting time if trying to solve with LLMs.
Asking it to write Nim code to solve my problem resulted in a mess of compilation errors, and it kept looping through multiple broken approaches when I pointed out what was flawed.
Finally, I just decided to ask it to explain the C design pattern I was unfamiliar with, and it was capable of bridging the gap enough for me to be able to write the correct Nim code. That was pretty cool. There was no documentation anywhere for what I needed, and nobody else had ever encountered that problem before. That said, I could have just gone to the Nim forum with a snippet and asked for help, and I would have solved the problem with a fraction of the electricity usage.
Or just 'learning the Rust syntax' and standard library?
As you said, LLMs are unpredictable in their output and will can generate functions that don't exist and incorrect code as you use more advanced features, wasting more time than it saves if you don't know the language well enough.
I guess those coming from dynamically typed languages are having a very hard time in getting used to strongly typed languages and then struggle with the basic syntax of say, Rust or C++.
Looking at this AI hype with vibe-coding/debugging and LLMs, it just favours throwing code on the wall with a lack of understanding as to what it does after it compiles.
This is why many candidates won't ever do Leetcode with Rust in a real interview.
So why not automatically try it, see if it fixes automatically, and if not then actually debug it yourself?
But everyone's entitled to their own choices.
5 cents, for every compilation error, for a 3/4 chance of success (which is likely disproportionately weighted towards errors I could trivially fix myself.) That easily works out to multiple wasted dollars an hour even if it only applies to manual compiler invocations, not accounting for any time wasted evaluating bogus solutions.
And yes there are some errors it gets stuck in a loop on. It’s not often and generally just switching to another LLM in cursor will fix it.
all of this looks very different when you have to patch in rust dependencies by hand outside of github.