Non-ugly ways to implement a 'static' class or namespace?

ProtectAndHide at gmail.com ProtectAndHide at gmail.com
Tue Feb 14 20:56:23 UTC 2023


On Tuesday, 14 February 2023 at 15:34:17 UTC, bachmeier wrote:
> On Tuesday, 14 February 2023 at 10:16:47 UTC, ProtectAndHide 
> wrote:
>
>> In any case, there is nothing 'picky' about wanting to be able 
>> to explicately 'declare' a member of my class type as being 
>> private. That to me, is what a programmer should expect to be 
>> able to do in a language that says it supports OOP.
>
> What you are saying is that you want an implementation of a 
> particular language that calls itself an OOP language. [There 
> is a lot of controversy about the definition of 
> OOP](https://wiki.c2.com/?NobodyAgreesOnWhatOoIs). I do not 
> think the explicit ability to declare a member of a class 
> private in a particular way has anything to do with it. You are 
> certainly entitled to your opinion, but it doesn't help to say 
> D is not an OOP language because you don't like some of the 
> design decisions.

It's true that not everybody understands what OOP is.

But I think everyone would agree, that data hiding is at the core.

First, I'm not advocating for OOP, or against it.

It's just a tool that's suitable in some scenarios, and not it 
others.

I'm also not a OOP purist.

Now with that out of the way....

D claims to support OOP. Put that to the test. Because there is a 
difference between programming with modules ('Decide which 
modules you want and partition the program so that data is hidden 
in modules.') and programming with 'user-defined types' ('Decide 
which types you want and provide a full set of operations for 
each type').

Data hiding is at the core of using modules.

It's also at the core of using types.

I refer interested people to:

"Most, but not all, modules are better expressed as user defined 
types." -

What is 'Object-Oriented Programming'? (1991 revised version) 
Bjarne Stroustrup

https://www.stroustrup.com/whatis.pdf




More information about the Digitalmars-d-learn mailing list