On 25/06/14 23:10, Tobias Pankrath via Digitalmars-d wrote:
Did you try using a method?module1 --- struct Subtype { private int x; public int getX() { return x; } alias getX this; } --- module2 --- import module1; void main() { Subtype st = Subtype(2); int x = st; } --- Works for me.
Yes, someone suggested this to me quite recently in fact. But I think it doesn't solve the real issue -- you're still exposing implementation details, as a user can always call getX directly.
