https://issues.dlang.org/show_bug.cgi?id=20358

Simen Kjaeraas <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #2 from Simen Kjaeraas <[email protected]> ---
Supporting Max's argument: test.d's author should have no knowledge of S's
private fields and their allowed values. A change in S's internals would lead
to breakage in unrelated modules.

The solution here would be to define the default constructor as private when a
struct has private members. Inside s.d this would allow the exact same usage as
now, while not giving other modules access to internals that arguably shouldn't
be available to them. Constructors would need to be defined explicitly to
initialize private fields when called from other modules.

I started out agreeing with RazvanN on this, but I think the above is the best
solution.

--

Reply via email to