how to make private class member private

Jonathan M Davis newsgroup.d at jmdavisprog.com
Tue Mar 13 22:56:31 UTC 2018


On Tuesday, March 13, 2018 22:25:52 Nathan S. via Digitalmars-d-learn wrote:
> On Tuesday, 13 March 2018 at 21:36:13 UTC, Arun Chandrasekaran
>
> wrote:
> > On Tuesday, 13 March 2018 at 13:59:00 UTC, Steven Schveighoffer
> >
> > wrote:
> >> On 3/12/18 10:06 PM, psychoticRabbit wrote:
> >>> [...]
> >>
> >> OK, so I agree there are drawbacks. But these can be worked
> >> around.
> >>
> >> [...]
> >
> > Private members still have external linkage. Is there anyway to
> > solve this?
>
> Yeah that's a real WTF.

It's how linking is normally done on Linux with C/C++ and has the advantage
of not having to mark any functions as being external like you have to do on
Windows. Personally, I've always found having to deal with that with C/C++
on Windows to be extremely annoying, whereas on Linux, shared libraries just
work. So, from a usability perspective, I can't say that I'm at all pleased
at the idea of having to mark anything as having external linkage in D.

The downside is that it increases the number of symbols which the program
has to deal with when linking against a shared library, which can have some
negative effects.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list