On Sat, 18 May 2013 02:12:00 +0200, Timothee Cour <thelastmamm...@gmail.com> wrote:

so in what you suggest, the exact same problem remains with 'get' being
exposed instead of 'x', so the situation didn't improve...

looks like it's impossible to achieve this?


Well, there is also opDot:

struct A(T) {
  private T x;

  T opDot() {
    return x;
  }
}

void main(){
  auto a = A!int;
  a++; //should do a.x++;
  static assert(!__traits(compiles, a.x)); // This now holds!
}

However, now A!int is not an int (you can't pass it to functions taking int).

--
Simen

Reply via email to