`restricted` member variables

Chris Katko ckatko at gmail.com
Tue Jun 21 20:52:22 UTC 2022


On Tuesday, 21 June 2022 at 19:27:10 UTC, 12345swordy wrote:
> On Tuesday, 21 June 2022 at 13:50:35 UTC, deadalnix wrote:
>> On Tuesday, 21 June 2022 at 12:53:06 UTC, Max Samukha wrote:
>>> You don't have any data to substantiate "much more useful", 
>>> do you?
>>
>> Unfortunately, this answer did not convince me that something 
>> needs to be changed.
>
> Is anyone here actually advocating to redefining private here? 
> I don't see why are you so opposed to optional features, unless 
> there some major drawback that outweighs the benefits that I am 
> unaware of?
>
> -Alex

That's my thinking. I really don't care about a war of debates. I 
need specific tools. I've already illustrated that it's a useful, 
fundamental construct that I use.

  - If someone can give me a 10 line patch to DMD that adds it, 
I'll use that fork from now on.

  - If someone can give me a optional compiler switch, I'll use 
that from now on.

  - If someone can give me a DScanner modified tool that scans for 
private violations but the compiler ignores it. I'll use that.

D isn't my baby. It's my tool.

I mean, we might as well flip it around and use these same 
arguments for the opposite. Why allow modular level private? If 
you're "git gud" programming, you shouldn't NEED modular private! 
Modular private is just a crutch for bad programmers that 
prevents you from expanding existing code, and D is all about 
expanding code.

And 'tossing literally every class into its own file' just to add 
private is an incredible statement. Oh yeah, let me toss up 
another 300+ files instead of organizing my project files based 
on topic and role, I'll just have an extra 300 files all over the 
place and have to deal with every single class being in its own 
namespace instead of having any benefit of shared namespaces. And 
I'm not crapping on whoever suggested it, it's just like we live 
in different worlds for you to even suggest that.

I'm trying to make games here, and I've already illustrated how 
that's apart of my rapid dev process. Make code work, then make 
it correct, and private is tool for lopping off sections of code 
and dealing with them.

Maybe private isn't needed for "D is just a shell scripting 
language" projects. But in a real codebase, private is typesafe 
documentation. It's a compiler-checked indication of correct 
usage. You may remember all the bells and whistles of 'best case 
usage' of your code today, but in two months you won't.

If I come off as overly harsh, I apologize, that's just how I 
communicate and it's not meant as a direct insult.



More information about the Digitalmars-d mailing list