> Imagine you are sitting in a meeting at work. The discussion is around the plan your team had set in motion last quarter, and the results are being reviewed. Data is being twisted and harassed to confess to whatever version of reality the group wants to see. You are sitting there, and you see through the charade.
> You’re wondering what the point of this is? You did not slog through life, battling inhuman entrance examinations, irrational parental expectations and eight rounds of interviews to get this coveted job, only to do this data jugglery. You’re wondering - why is nobody asking the fundamental, first principles questions? Why are we not questioning our premise? Why are we misinterpreting cause and effect? Why are we chasing these vanity metrics, when the metrics themselves are poor indicators of reality? Why have we accepted as gospel truth some ‘self-evident’ principles?
> The meeting is adjourned, congratulatory messages are passed around, and a vague way forward is discussed. You shake your head, sigh deeply and groan internally, grab coffee and head to the next meeting.
I call people like the author of this post "intellectual superiors". You know, like in the meme with the fedora-wearing man looking out of a window. I was like him when I was in high school. Now trying to keep my ego in check, still struggling sometimes...
But even though the guy is such an intellectually superior person, he didn't manage to come up with the idea that maybe he's there in that meeting to... contribute? You know, you're part of the team, you're in the meeting for a reason, if you disagree with others, it's your responsibility to say it? You may be right that they are misrepresenting the data or arriving at wrong conclusions -- but it doesn't matter, because you chose to instead indulge yourself silently at feeling superior over these sheep.
Yeah it's weird but the author of this post claiming that defer can replace RAII kinda suggests that. RAII isn't just about releasing the resource you acquired in the current scope in the same scope. You can pass the resource across multiple boundaries with move semantics and only at the end when it's no longer needed the resources will be released.
The author of the post claims that defer eliminates the need for RAII.
Well, goto also eliminates the "need" but language features are about making life easier, and life is much easier with RAII compared to having only defer.
It makes things easier. Usually the move constructor (or move assignment operator) will cause the moved-from object to stop being responsible for releasing a resource, moving the responsibility to the moved-to object. Simplest example: move- construct unique-ptr X from unique-ptr Y. When X is destroyed it will free the memory, when Y is destroyed it will do nothing.
So you can allocate resource in one function, then move the object across function boundaries, module boundaries, into another object etc. and in the end the resource will be released exactly once when the final object is destroyed. No need to remember in each of these places along the path to release the resource explicitly if there's an error (through defer or otherwise).
I agree that it makes some things easier (at the expense of managing constructors/destructors), I'm disputing the blanket assertion that it's superior to manual management, in the context of Jai (and Odin). You're also introducing a reference count, but that's besides the point.
In Jai/Odin, every scope has default global and temp allocators, there's nothing stopping you from transferring ownership and/or passing pointers down the callstack. Then you either free in the last scope where the pointer lives or you pick a natural lifetime near the top of the callstack, defer clear temp there, and forget about it.
You may also want to pass a resource through something like a channel, promise/future pair or similar. So it's not just down/up the callstack, sometimes it's "sideways". In those cases RAII is a life savior. Otherwise you have to explicitly remember about covering all possibilities:
- what if resource never enters the channel
- what if it enters the channel but never gets retrieved on the other side
- what if the channel gets closed
- what if other side tries to retrieve but cancels
There's a school of thought that correctly states that in that case it is very easy to cause expensive drop behavior to be ran for each element in the vector where a faster batch approach could instead be done, which is doable if not encouraged with defer, so it should be prioritized to push people towards that.
I do not subscribe to that idea because with RAII you can still have batched drops, the only difference between the two defaults is that with defer the failure mode is leaks, while with RAII the failure mode is more code than you'd otherwise would have.
If you were on such good terms with VP of Eng and C-levels, why didn't you reach out to them and ask what's going on? They could interfere and prevent your layoff.
> The main issue that I see is that interviewers get extra picky with all the minor details and they fail candidates due to minor issues that would get solved in a code review or just with a bit more time
You see a "minor issue that would get solved in a code review".
I see a production outage.
You cannot rely on others catching and fixing your bugs. It happens, but it's all about probabilities. You want to reduce the probability that something bad will happen. That means not just relying on more senior people to catch problems in your code, it also means relying on you to be careful.
No, I see people complaining about a test not looking like what they expect, or minor nitpicks like variable names or not using the interviewer's favourite design pattern
Of course the same people who nitpick are the ones writing O(n^2) code and actually causing a major bug
Ok, I was thinking about something else than stylistic preferences, e.g. making an off-by-one error in an implementation of an algorithm during live coding. Something that indeed would be usually catched by a careful code review, but candidates sometimes undermine importance errors.
Skynet sends Terminator to eradicate humanity, the Terminator uses this as its internal reasoning engine... "instructions unclear, dick caught in ceiling fan"
> You’re wondering what the point of this is? You did not slog through life, battling inhuman entrance examinations, irrational parental expectations and eight rounds of interviews to get this coveted job, only to do this data jugglery. You’re wondering - why is nobody asking the fundamental, first principles questions? Why are we not questioning our premise? Why are we misinterpreting cause and effect? Why are we chasing these vanity metrics, when the metrics themselves are poor indicators of reality? Why have we accepted as gospel truth some ‘self-evident’ principles?
> The meeting is adjourned, congratulatory messages are passed around, and a vague way forward is discussed. You shake your head, sigh deeply and groan internally, grab coffee and head to the next meeting.
I call people like the author of this post "intellectual superiors". You know, like in the meme with the fedora-wearing man looking out of a window. I was like him when I was in high school. Now trying to keep my ego in check, still struggling sometimes...
But even though the guy is such an intellectually superior person, he didn't manage to come up with the idea that maybe he's there in that meeting to... contribute? You know, you're part of the team, you're in the meeting for a reason, if you disagree with others, it's your responsibility to say it? You may be right that they are misrepresenting the data or arriving at wrong conclusions -- but it doesn't matter, because you chose to instead indulge yourself silently at feeling superior over these sheep.
Philosophers... right?
reply