Comments

curl-up 6d
How come general developer audiences aren't more acquainted with GPT-3 (and Codex in particular) capabilities? People in the twitter thread all seem completely mind blown over an app that basically just passes your code to an existing API and prints the result.

I don't want to sound negative of course, and I expect many of these apps coming up, until Codex stops being free (if they put it on the same pricing as text DaVinci model, which Codex is a fine-tuned version of, it will cost a ~cent per query). I'm just wondering how come the information about this type of app reaches most people way before the information about "the existence of Codex" reaches them.

For all the publicity around Codex recently (and especially on HN), it still seems like the general IT audience is completely unaware of the (IMHO) most important thing going on in the field.

And to anyone saying "all these examples are cherrypicked, Codex is stupid", I urge you to try Copilot and try to look at its output with the ~2019 perspective. I find it hard to beileve that anything but amazement is a proper reaction. And still, more people are aware of the recent BTC price, than this.

Source: have been playing with Codex API for better part of every day for the last few weeks. Built an app that generates SQL for a custom schema, and have been using it in my daily work to boost ma productivity as a data scientis/engineer/analyst a lot.

wudangmonk 6d
TLDR but you actually end up reading even more than the original. I could be wrong and this might actually work and condense a big function but if that is true, why showcase such an example.
PennRobotics 6d
... until it gets to

    i  = 0x5f3759df - ( i >> 1 );
waynesonfire 6d
like the auto summarize feature from MS Word that helped me do my homework back in high school
galangalalgol 6d
Can we get this for legal documents? Maybe with the ability to spot things that might be loopholes?
hn_throwaway_99 6d
FWIW, when I'm doing a code review, these are the exact kind of comments that I would tell a committer to remove.

That is, it's like it generates these kinds of comments:

    // initializes the variable x and sets it to 5
    let x = 5;

    // adds 2 to the variable x and sets that to a new variable y
    let y = x + 2;
That is, IMO the whole purpose of comments should be to tell you things that aren't readily apparent just by looking at the code, e.g. "this looks wonky but we had to do it specifically to work around a bug in library X".

Perhaps could be useful for people learning to program, but otherwise people should learn how to read code as code, not "translate" it to a verbose English sentence in their head.

worble 6d
I just don't trust it, I've worked with GPT-3 before and it sure does a real good job of sounding convincing, but if you don't understand the code there's no way to know if what it's saying is accurate, or whether it's just regurgitating random nonsense that sounds plausible.

It knows how to create sentences that sound like something a human would write, and it's even good at understanding context. But that's it, it has no actual intelligence, it doesn't actually understand the code, and most importantly, it's not able to say "Sorry chief, I don't actually know what this doing, look it up yourself."

howmayiannoyyou 6d
This would be invaluable for communicating with my teenagers.
billsmithaustin 6d
So it translates the code into COBOL. That's awesome.
bloppe 6d
Why not just type the code into DALL-E 2 and have it paint a picture of what the code does?
jopnv 6d
Very fancy but, in my opinion, completely useless as a development tool. I can’t see how reading natural language is better than reading code.
iLoveOncall 6d
Reading the code explains what a piece of code does.
ianbutler 6d
I wrote something similar before, my friend had a nice technique to do code analysis and remove everything but the critical path to the point in code you had your cursor over. Then I fed that code path into gpt3 to generate an explanation of that critical path.

Wound up being useful for explanations of long code paths across file boundaries in large code bases.

xwowsersx 6d
I don't know that I have much of a need for this and, although I'm hesitant to provide crutches to people especially when they're in the early stages of their learning, this might be helpful for more junior people who are ramping up, especially in a large project. Is there a way to use this or something similar today in PyCharm, etc?
hot_gril 6d
Seems more useful for finding bugs in code than for explaining properly working code. "Returns false if the signature matches."
reidjs 6d
That’s cool but I don’t think it’s very useful once you’re familiar with the codebase. It’s quicker to scan the code at that point.

If it could give you some context about the implications I could see it being handy for static analysis one day.

angst_ridden 6d
The kinds of comments that are useful are less about what the code already tells you is happening, and more things like:

/* we don't use the actual price but the discounted price, as per email from Manager Bob on 2022-09-16 */

subtotal += price * customer_discount_factor;

or

/* note there's a 2ms delay while relays settle; this is subtracted from sample time, so timeout is not what you might expect */

select(0,&readfd,NULL,NULL,&timeout);

tayloramurphy 6d
Before clicking through I thought this was for this great command line tool [0]. I'm skeptical about GPT-3 generated comments, but I can recommend the other TLDR whole heartedly!

[0] https://github.com/tldr-pages/tldr

Waterluvian 6d
This looks like it has potential value for beginners who are looking to learn what code syntactically means.
metalrain 6d
I think tool like this can make sense if you cannot read the code.

Probably this still gets confused like humans do when variables and functions are named less clearly or even plainly wrong.

I wonder if reading explanation like this makes you more likely to believe code is correct, even if some details are wrong.

In this signature example, you can read the wrong header, calculate hash the wrong way, compare hashes wrong way, etc. there are some many tiny mistakes.

CrendKing 6d
Imagine this tool could reverse engineer minified Javascript code. Depending on the result, it has potential to defeat minification as whole.
heratyian 6d
This could be helpful for debugging/refactoring legacy spaghetti code.
hooby 6d
The question is - can this actually explain the code which really needs explanation - or can it only explain code that should be easy and straight forward to read anyway?

And does having this reduce the amount of discomfort badly readable code creates, and thus make you less inclined to take care the code is and stays easily readable?

jfoutz 6d
ya know, I hacked up a poc today that does something along the lines of

subprocess.run("docker exec mysql /bin/bash -c 'while mysqladmin ping do sleep 1; done; while mysql < dump.sql do sleep 1;'")

and I kinda would like some hints about how to comment that. admin will tell you the server has started, but it's not quite ready to load up the data. It's passing through a few context layers. I'll shuffle it around a little I think. I'll definitely have a comment for it.

f1shy 6d
No only I find the tool not useful, as it just state the obvious. My personal opinion is the code should be already very near what the tool gives. The code should be clear enough for not needed such tool. If you need it, you have a very different problem, my friend.
forty 6d
I know it's completely missing the point here but: it's a good habit to verify signature using constant time comparison rather than == to avoid timing side channel attack :)
codeenlightener 5d
looks great, reminds me of our product, https://denigma.app that explains the business logic of code and technical concepts, which recently launched an extension for all Intelli-J based IDEs (except Android Studio- there's a compatibility issue with it)
stokesr 5d
Compsci first years are definitely going to use this to complete "Recreate this algorithm in pseudocode" assignments