Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Put all your free points into diplomacy and then use a rephrased version of that text as an answer to the "need moar infoz" reply.
-
cprn17443yWhat Oktokolo said. And when you're at it suggest removing comments and making the code clearly readable instead.
But seriously, how do you know that code wasn't supposed to replace values when some conditions occur? Comments might be out of date. And some version control systems exists specifically to restrict access. Not everything is open source nor it should be. -
hitko31463y@cprn Imagine an algorithm for going to the store:
- you wife gives you a list of items
- you go to the store and get a shopping cart
- you cross each item from the list and add it to the cart
Then you try to optimise it:
- you wife gives you a list of items
- you go to the store and take a shopping basket
- you cross each item from the list and add it to the basket
- if the basket gets full, you get a shopping cart, and proceed to add the remaining items to the cart
You didn't intentionally leave the basket full of items you were supposed to buy in the store, you fucking forgot to add a step where you move them from the basked to the cart. And everyone who sees you leaving a full basket of items somewhere in the store when you get the cart can tell that you're forgetting something. -
@cprn some languages have fixed arrays by design, so it isn't that weird really. It actually is the behaviour i know from arrays. A dynamically expanding Array would be would be more like a list.
-
cprn17443y@thebiochemic I agree. OP's talking about merging so I assumed it's dynamic, however, it might be some stack/heap optimisation code - didn't think about that. "Bad VCS without MRs" suggests SVN which would mean enterprise environment. Usually people who write this kind of code in low level languages and do this commercially know what they're doing. This bug suggests somebody really (like really really) didn't know. And if it was a high level language it should handle resizing arrays for you so replacing a "basket" with a "shopping cart" wouldn't be required in the first place. That's why this whole situation is surprising to me.
Dear X. There's an obvious error with the way you're merging arrays; instead of conditionally adding items to the existing array, each condition overrides any items added by the previous conditions, which is clearly not the desired behaviour. I'd love to add a test to illustrate this behaviour, but you're not using them. I'd also love to create a simple pull request, but for some fucking reason you're using the worst possible version control system so I can't do that. I've submitted a support ticket along with all the code needed to fix this silly mistake, but apparently you either don't understand 2 lines of your own fucking code, or you didn't even bother looking at it before posting a shitty generic reply about "needing more information". There is no such thing as more information. There are two IFs, and they are supposed to add items to the array, not override any previous items. It's written in your own comments, and it's pretty obvious from the way the rest of the function merges those items.
Also, use a fucking linter, your code is a mess.
rant