HACKER Q&A
📣 tmaly

ChatGPT best programming language to use?


If you are going to ask ChatGPT to write code, which programming language would you ask it to use and why?

I had thought maybe rust, but I read some threads and people were stating the code it writes would not compile sometimes.


  👤 smt88 Accepted Answer ✓
Rust is a good idea because "does not compile" is better than "contains lots of errors, but compiles/runs anyway". No one should be running ChatGPT-produced code without carefully proofreading it anyway.

The training set likely contains more JavaScript than any other language, so the resulting code quality would probably be the best, but JavaScript is also the most tolerant mainstream language and would tolerate a lot of runtime errors.


👤 muzani
The original was mostly trained on Python[1], but JS seems a close second. So I assume python has the highest quality. If you don't specify a language, it seems pick either of these.

[1] https://openai.com/blog/openai-codex


👤 speedgoose
I think it works best in Python, but I don’t have numbers to bring. It’s just how I feel. Other languages have more wrong answers.

👤 jawmes8
I’ve been using it to learn SQL - it’s been helpful asking it to explain queries or joins that I want to perform.

👤 darthrupert
It generates pretty good Typescript, if it doesn't select a deprecated library.

👤 Princesscaraan
Chatgpt help me in a very nice way. though sometimes my needs not available. There's a trick how to proper ask chatgpt.