It seems like 90% of the posts here are nitpicking minor things without giving the more context, i.e. this post, or bashing code written by someone who just started learning to code and doesn't know about some feature or another.
Let's just face it there isn't that many examples of bad code to go around, so we're scraping the bottom of the barrel. There ARE scenarios where this is applicable.
I have a question, does it work? If the code works as intended and is shippable in its current form, what's there to complain about in this example?
Depends on the context. There’s always a bizarre reason that code written in weird way was for a purpose, edge case or not. It’s especially hard to tell when your image only show one line code.
Nobody likes to write unnecessary complex code, and you almost always should be thankful that you were not the one who had to deal this 💩when other might had spent hours, or god forbid, days, to write seemly bad code to get around some edge cases.
165
u/Voltra_Neo Feb 03 '23
Technically this creates a copy, so if there's reactivity or proxies going on, this might actually be what you want
67
u/Kreamcheez Feb 03 '23
Is this really what we’re complaining about now?
33
u/theOrdnas Feb 03 '23
lmao this subreddit is just as bad as r/programmerhumor
4
u/Bisquizzle Feb 03 '23
Let's just face it there isn't that many examples of bad code to go around, so we're scraping the bottom of the barrel. There ARE scenarios where this is applicable.
I have a question, does it work? If the code works as intended and is shippable in its current form, what's there to complain about in this example?
15
u/nathan_lesage Feb 03 '23
Without context, it’s hard to say. That very construct saves me a ton of “could not serialise to JSON” errors. My code is littered with these.
4
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Feb 04 '23
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
1
u/Grindarius Feb 04 '23
Could this be someting for converting ArrayLike to Array?
1
u/amnotatiger Feb 04 '23
But why though?
1
u/nicpro85 Feb 10 '23
Where is the flatMap .first ?? "email@example.com"
0
u/[deleted] Feb 04 '23
[deleted] — view deleted comment