216
LISP is ugly (lemmy.ml)
you are viewing a single comment's thread
view the rest of the comments
[-] emerald@lemmy.place 57 points 2 years ago

If your code is that deeply nested, surely something has gone horribly wrong, yes?

[-] yogthos@lemmy.ml 15 points 2 years ago

Problem is that Js kind of encourages this being single threaded and using callbacks for anything blocking. To be fair, the new async syntax sugar helps in modern Js, but nesting a bunch of callbacks or promises was basically the way you did stuff for the longest time.

[-] h_a_r_u_k_i@programming.dev 10 points 2 years ago

Code aesthetic: If your code looks like a triangle, you're seriously doing something wrong.

[-] Blackmist@feddit.uk 5 points 2 years ago

I prefer a bunch of

if (fucked_up) {return(error_code);}

for checking common errors.

[-] DWin@sh.itjust.works 2 points 2 years ago

Yup, never nest.

All the conditions should be checked and returned if they failed as you go through the function with the successful response being the last line.

this post was submitted on 24 Sep 2023
216 points (93.5% liked)

Programmer Humor

41294 readers
213 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS