Re: Preparing for the New DIP Process

2024-01-28 Thread John Thomas via Digitalmars-d-announce

On Sunday, 28 January 2024 at 04:47:30 UTC, FairEnough wrote:


module test;
@safe:

import std;

class C
{
private(this) int x; // intent: other code in this 
module cannnot mutate this.
private(this) int y; // intent: other code in this 
module cannnot mutate this.


invariant () { assert (x == y); }

void modifyX() {...}
void modifyY() {...}
}


void foo(C c)
{
c.x = 10; // compiler will not compile this code.
c.modifyX();
}


Thank you for posting a very informative example, i think not 
just myself but everyone else on this forum had completely forgot 
how class private is supposed to work. In spite of the 1000 or so 
posts you've made about it.


Keep up the good work!


Re: Preparing for the New DIP Process

2024-01-27 Thread John Thomas via Digitalmars-d-announce

On Saturday, 27 January 2024 at 19:58:55 UTC, Jordan Wilson wrote:

On Saturday, 27 January 2024 at 10:42:26 UTC, FairEnough wrote:

On Saturday, 27 January 2024 at 08:00:32 UTC, Jordan Wilson

I believe we are now in the "there is nothing more to be said" 
territory (just for the record, I think we both agree the 
feature is good, I just don't think the feature is necessary at 
all...nice-to-have at best. I suspect we'll agree to disagree).


Its probably more useful if you manage a team of barely competent 
idiot programmers.




Re: Preparing for the New DIP Process

2024-01-27 Thread John Thomas via Digitalmars-d-announce

On Friday, 26 January 2024 at 23:41:51 UTC, FairEnough wrote:
On Thursday, 25 January 2024 at 00:19:54 UTC, Jordan Wilson 
wrote:


...
That wasn't what was said. What was said was "causing US 
problems". I.e. on the whole, the lack of class-level privacy 
does not appear to be causing widespread problems, which 
implies that it's simply lower on the list of feature requests 
for most people.




Allowing mutable state to escape - the confines of the type in 
which it has been declared - into the whole of the module, will 
inevitably lead to a problem.


My first use of the D language demonstrated that this statement 
is factual.


The more 'widespread' D is used, will 'likely' also demonstrate 
the same.


What we need to do is find a way to make the computer explode 
when somebody does that. Weed out the stupid programmers. ;-)