AI can write code like humans, bugs and all
wired.com
wired.com
convertList(node: MooASTNode): List {
And then it just spits out:
const entries: ASTNode[] = node.children.map((child) => {
return this.convertNode(child);
});
return new List(entries, this.sourceLocation(node));
}
This isn't exactly difficult to write or reason about, but it did save me quite a bit of time to just dash out the code that converts the parse tree to an intermediate tree in an hour or so and then just quickly look over and make a couple corrections.It also helped making the ASTNodes, for instance:
export class If extends ASTNode {
resulted in:
constructor(
public condition: Compare,
public then: ASTNode,
public elseDo?: ASTNode,
public override loc: SourceLocation | null = null
) {
super();
condition.parent = this;
then.parent = this;
if (elseDo) {
elseDo.parent = this;
}
}
@logCall
toEstree() {
return builders.ifStatement(
this.condition.toEstree(),
this.then.toEstree(),
this.elseDo?.toEstree()
);
}
}Again, this code is not gonna win any prizes, but it sure did save me a good chunk of time. Why so much hate for the tool?
Edit: At least for me it isn't obvious at all that those snippets are correct.
Brilliantly articulated - thank you. I wonder if this is a generic pattern (like fallacies)?
Obviously that is how _I_ type code, and not something that can generalize to how others work. So it's my preference to still think about my code before, and while, I write it.
Whose code did it copy and how is that code licensed?
And this is before GitHub will start charging for it.
But from a QA perspective close isn't enough.
# Writing a good docstring
This is an example of writing a really good docstring that follows a best practice for the given language. Attention is paid to detailing things like
* parameter and return types (if applicable)
* any errors that might be raised or returned, depending on the language
I received the following code:
```{{{language}}}
{{{snippet}}}
```
The code with a really good docstring added is below:
```{{{language}}}
If you wanted a docstring in a particular format, you could add some specific examples as context to your prompt to get even better results.What would be an immense multiplier of software eng productivity is an intelligent auto-fixer tool: a compiler gives you an error, you know how to fix it, but it's a tedious work that wastes most of your time. Think of fixing build deps, rewriting method signatures to match the parent class, properly adding a library to your project. You'd write "include ssl.h; encrypt(message)" and the tool would add all the plumbing around it, in line with project guidelines.
Analyzing, debugging, and fixing code is what we do all day.
It reminds me of people strongly against autocomplete for variable/function names.
What you're mentioning will happen, some developers will use the tool the right way. I just don't think that will be the prevailing pattern.
When the AI/ML programs can actually create lines of code without references and do it with quality that’s when there’s a real story that isn’t playing tricks on tech authors for stock gains.
Tricks like this are why everyone always thinks big innovation is 5 years away when no one is really working on the things that’s make it 5 years away.
AI currently does not understand language well enough, it recognises patterns but does not understand what its doing and why.
AI is still too far away from real understanding.
AI isn't magic, it can't solve problems you don't give it. When doing alpha go they gave the AI all the rules for GO and told it to optimize for those rules. That works fine. But if you want it to make a web-app, what rules would you give it to optimise for? Do you have a web-app evaluator lying around somewhere we can use? If not I don't see it happening.
The current code helper solved that by telling the AI to solve the problem "write code that looks like this bunch of human written code". The AI can do that just fine, but code that looks like human written code isn't terribly useful since the AI doesn't understand what makes the code good, all it knows is that the code looks similar to what a human once wrote. This is cool, but as you can see this is very different from the real deal where the AI solves the real coding problem rather than "write something that looks like code" problem.
Basically, you write a test, let the algorithm find the program that passes it. Hopefully, at one point you reach GPT-3 level performances where it is able to imagine programs for tests it never saw.
> Hopefully, at one point you reach GPT-3 level performances where it is able to imagine programs for tests it never saw.
You mean nonsense programs just like GPT-3 generates nonsense articles? GPT-3 doesn't remember the logic in its sentences, and in order to solve programming competition problems you need to translate logic from human text into code.
I agree that it might be possible to get something useful this way, but until it actually works I'll doubt it will work. There is just way too much coherence required that doesn't seem to be there yet, and from what I've seen the coherence problem gets exponentially worse as you get larger problems.
These approaches discover concepts and the relationship between them, and use that in their tasks. It is not far-fetched to say that there is some kind of understanding there.
For now we have trained it to generate fake text and basically made a master bullshitter, but I have no doubt that it can easily extract meaning and intent from text.
Have you met humans? People do not supply complete or self consistent information on what their goals are. They do not form objections to the output of a program based on an accurate and complete model of it either.
Also, they hate to communicate via text - how many times have you heard "ugh, let's discuss it on a call"?
But that does not mean you can BS them endlessly. The fact that people have no idea about the technical details doesn't mean they are going to accept failure.
I'd like to see an AI that can dominate https://en.wikipedia.org/wiki/Nomic
I'm terrified of the day when the answer to that is, "a better AI".
this will reduce the amount of "possibilities" w.r.t. code by orders of magnitude and therefore make it easier to both read, write, and development tools to automate code.
of course this will necessarily reduce innovation, but at the expense of higher quality code, easier to maintain code and skills that are more transferrable.
It's also decent at doing tasks that would be easy for a beginner programmer but perhaps tedious. Like you can give it a function for generating random colors and a task like "expand the variable names in this function to be better", and it will change variable names like `r`, `g` and `b` to `red`, `green` and `blue`. Hardly amazing, and the latency of the API means it's not actually that useful in practice (yet), but with the right prompt it can do some impressive things, and I expect it to get much better in the near future. Pulling magic strings out of functions into constants and adding typehints to Python functions are other simple tasks I've found it OK for.
https://www.damninteresting.com/on-the-origin-of-circuits/
> Dr. Thompson peered inside his perfect offspring to gain insight into its methods, but what he found inside was baffling. The plucky chip was utilizing only thirty-seven of its one hundred logic gates, and most of them were arranged in a curious collection of feedback loops. Five individual logic cells were functionally disconnected from the rest — with no pathways that would allow them to influence the output — yet when the researcher disabled any one of them the chip lost its ability to discriminate the tones. Furthermore, the final program did not work reliably when it was loaded onto other FPGAs of the same type.
Programming is ironically one of the worst use cases of AI, because often predictable failure is better than unexpected success.
"Fix the null pointer exception" is less expensive (time, money and mental energy) than "figure out why the code spits out garbage even though the test cases pass".