June 04, 2022

On Saturday, 4 June 2022 at 12:57:16 UTC, zjh wrote:

>

Is there no difference between class level encapsulation and module level encapsulation?

Encapsulation is very very important, At any level. you don't want class encapsulation and don't think it's worth it?

June 04, 2022

On Friday, 3 June 2022 at 12:06:01 UTC, zjh wrote:

>

On Friday, 3 June 2022 at 10:20:08 UTC, bauss wrote:

>

class Foo
{
private class string _id; // Private to the class
}

>

class Foo
{
private module string _id; // Private to the module
private int _number; // Same as "private module" since that's the default
}

I think it is worth adding. Simply adding some code can distinguish between class level and module level. It is very friendly for those familiar with C++'s class level encapsulation.

it adds more special cases to metaprogramming for practically no benefit.

June 04, 2022

On Saturday, 4 June 2022 at 13:37:18 UTC, Commander Zot wrote:

>

On Friday, 3 June 2022 at 12:06:01 UTC, zjh wrote:

Language is inherently complex.Obviously, d did not distinguish between module level encapsulation and class encapsulation. Finally, you told me that this will added "special cases".

June 04, 2022

On Saturday, 4 June 2022 at 13:41:43 UTC, zjh wrote:

>

Finally, you told me that this will added "special cases".

If you dare not face the problem directly, you will only get more and more problems.

June 04, 2022

On Saturday, 4 June 2022 at 13:41:43 UTC, zjh wrote:

>

Language is inherently complex.

Well, that is a problem, as the main selling point is to be simpler than C++!!

June 04, 2022

On Saturday, 4 June 2022 at 13:56:07 UTC, Ola Fosheim Grøstad wrote:

>

On Saturday, 4 June 2022 at 13:41:43 UTC, zjh wrote:

>

Language is inherently complex.

Well, that is a problem, as the main selling point is to be simpler than C++!!

If you want to meet the needs of more and more users, you must be complex.
Otherwise, you are cheating.

June 04, 2022

On Saturday, 4 June 2022 at 14:08:24 UTC, zjh wrote:

>

If you want to meet the needs of more and more users, you must be complex.
Otherwise, you are cheating.

More and more users are using Python… Cheating pays off!

June 04, 2022

On Saturday, 4 June 2022 at 14:08:24 UTC, zjh wrote:

>

On Saturday, 4 June 2022 at 13:56:07 UTC, Ola Fosheim Grøstad wrote:

>

On Saturday, 4 June 2022 at 13:41:43 UTC, zjh wrote:

>

Language is inherently complex.

Well, that is a problem, as the main selling point is to be simpler than C++!!

If you want to meet the needs of more and more users, you must be complex.
Otherwise, you are cheating.

class private does not provide anything you can not already express in D.
if you don't want access to you class, put it in it's own module where it belongs.
but really this problem should not arise in the first place, because you should use interfaces anyway. a class should be an implementation detail.
if anything we could add the ability to declare multiple modules in one file, but i'm not a fan of that either.

June 04, 2022

On Saturday, 4 June 2022 at 14:21:41 UTC, Ola Fosheim Grøstad wrote:

>

More and more users are using Python… Cheating pays off!

Cheating first feel good, but then it all fell into bad luck.

June 04, 2022

On Saturday, 4 June 2022 at 14:23:42 UTC, Commander Zot wrote:

>

because you should use interfaces anyway. a class should be an implementation detail.

For me, it would be better ,if I could encapsulate at class level.In any case, I don't want the outside to affect my class inside.