3 ms·
That gave me an idea. Is it possible to ask an AI what a variable/function does in a piece of code? I've only ever used them for generation.
by AlienRobot 1y ago
That gave me an idea. Is it possible to ask an AI what a variable/function does in a piece of code? I've only ever used them for generation.
- reilly3000 1y agoAbsolutely, it’s a great use of the tools. I use it to explain unfamiliar idioms or large functions on a regular basis.
- 1718627440 1y agoBut it can only amplify information already present in the code or apply "common sense" from other code bases, in other ways the things a programmer already does. In addition LLMs recognize "meaning" mostly like prose, i.e. they take the code behaviour mostly from the names of the variables and functions less from the actual behaviour. When you name everything randomly, then a LLM is way worse to recognize what the code is doing. This means that when the code is already confusing, wit naming doesn't match behaviour than the LLM is more likely to tell you the story from the naming not the story of actual behaviour.
- primer42 1y agoI do this literally every day when I'm debugging, understanding a new system, or planning my work.
- rf15 1y agoNo. Your understanding is only as good as what you saw for yourself, no superficial explanation will serve you. Of course, the LLM will not even give you a suitable answer anyway for anything beyond trivial code snippets.
- mceachen 1y agoYou can, but with Claude, be sure to watch what files it reads—I’ve seen close to entirely incorrect analysis due to shallow/lazy reading. If you think it’s phoning it in, tell them to study upstream and downstream consumers, consider edge and corner cases, and what assertions any tests are making of the code in question, and to redo their analysis.