51 days ago · Tech · hide · Fediverse post

I had ChatGPT write a JavaScript for me, and was surprised to see this arrangement: function main() { // Do work... } try { main(); } catch (error) { console.error(error); process.exitCode = 1; } I would not have written this file this way; instead, I’d have put a try/catch in the file directly and probably forgotten the exit code. This lets my script return nonzero on any error and be chained with other scripts. And it encapsulates the work in main(), a C-like flourish I admire.

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town