4 ms·
> to achieve some hack or optimization. Or functionality. Happens to me all the time I have some Java class that's marked Final, so instead of just extending t
by ars 1y ago
> to achieve some hack or optimization.
Or functionality. Happens to me all the time I have some Java class that's marked Final, so instead of just extending the class and moving on, I have to copy/paste the entire class wholesale to accomplish my goal.
Personally I hate "nanny" languages that block you from accessing things. It's my computer, and my code, and my compiler. Please don't do things "for my own good", I can decide that for myself.
(And yes, I am aware of the argument that this lets the original programmer change the internals, in practice it's not such a big problem. Or the cure is worse than the problem - for example my copy/paste example.)
Another example is a private constant. Instead of allowing me to reference it, I have to copy it. How is that any better? If the programmer has to change how the constant works then they can do so, and at that point my code will break and I'll .... copy the constant. But until then I can just use the constant.
- Tractor8626 1y agoTypical "early-in-carrier" thinking. Copying implementation is totally correct move here. All projects mentioned should have forked stdio and added their hacks/optimisations/functionality to that. They were just too lazy. Can't blame them though. Writing C code is torture after all. One should cut all the corners they could.
- ars 1y ago> Typical "early-in-carrier" thinking. Other way around. When I first started I thought these access restrictions were a great idea. Make sure, I, and other, only program "correctly". When I got more mature I found how often they are impediments, and how little they actually help. I don't want someone else protecting me from myself. I just don't want that, no matter how well intentioned.
- Tractor8626 1y agoWhat I meant are "avoid copy paste at all cost" and "I'm center of the world. What I want is the only thing that matters"-thinking. About access restrictions. We have two nice examples here 1. Stdio devs can't freely make modifications because someone's code depends on private implementation details 2. And yours example. You tried to do wrong thing and those access restriction made you suffer and do the right thing. Works as intended I'd say.
- high_na_euv 1y agoAccess modifiers exist so ppl dont shoot themselves
- ars 1y agoI never asked anyone for such protection, and I don't want it.
- high_na_euv 1y agoFortunately as time showed such things are over all beneficial for software engineers worldwide You can usually use other langs