3 ms·
> Why many programmers need tools to enforce something upon them? Why not they can't take slow, be mindful about what they write and add a couple of layers as p
by dale_glass 3y ago
> Why many programmers need tools to enforce something upon them? Why not they can't take slow, be mindful about what they write and add a couple of layers as pre-commit hooks? Like a code formatter and maybe a linter?
Why would I want to? Most of that is boring stuff that's hard to get consistently right and highly amenable to automation. Automation is what the computer is good at, it can have that job.
Like, why would I want to spend more mental bandwidth on tracking down whether every new goes with every delete than strictly necessary? Yeah, once in a while something is highly performance sensitive and it pays to design it just right for the use case. But it still tends to be surrounded with hundreds of other things that will do just fine with a smart pointer.
- chris_wot 3y agoSo use RAII and smart pointers. I think that's the point.
- dale_glass 3y agoYes, exactly what I'm saying. Use tooling to do the boring parts of your job.
- chris_wot 3y agoIt’s not tooling, it’s the language.
- Novosell 3y agoLanguages are not tools?
- CyberDildonics 3y agoEvery programmer knows the difference the language and the tools surrounding it. This seems like you're trying to create a pointless semantic argument for no reason.
- bayindirh 3y ago> Automation is what the computer is good at, it can have that job. Pre-commit hook is automation. It formats the code and gives you linting notes the moment you write "git commit". > Like, why would I want to spend more mental bandwidth on tracking down whether every new goes with every delete than strictly necessary? It's not more mental bandwidth for me. Because I write the new, and directly delete at the point I need to, then I never think about it again. If I botch something, valgrind will tell me, even pinpointing it with line number. > ...other things that will do just fine with a smart pointer. If that works for you, use it. I have no objections.
- dale_glass 3y ago> Pre-commit hook is automation. It formats the code and gives you linting notes the moment you write "git commit". So isn't that a tool that enforces something upon the programmer? > If I botch something, valgrind will tell me, even pinpointing it with line number. What is the benefit of needing valgrind? Isn't it even better to have the task automated away so that the problem doesn't even come up?
- bayindirh 3y ago> So isn't that a tool that enforces something upon the programmer? It's a tool I voluntarily add to my workflow, which works the way I want, when I want, according to project needs. It's not a limitation put upon me by the language/compiler/whatnot. > What is the benefit of needing valgrind? Isn't it even better to have the task automated away so that the problem doesn't even come up? In most cases, performance (think of HPC levels of performance). If I don't need that kind of performance, I can just use the stack or smart pointers. If we're talking about moving to other programming languages, I'd rather not.
- dale_glass 3y ago> It's a tool I voluntarily add to my workflow, which works the way I want, when I want, according to project needs. It's not a limitation put upon me by the language/compiler/whatnot. I spent a lot of time maintaining a lot of Perl code. While it was generally very well written, it also made me a big fan of strict, demanding compilers. Perl is quick to write, but can have very high debugging costs since it'll let you get away with a lot that it shouldn't like having a function called with arguments but that completely forgets to retrieve them. Based on my experience, IMO any class of error that can be eliminated, should be. So my modern approach is -Wall, -Werrors, -Wextra, and anything else that can be had to that effect, all the time.