On 2013-01-30 17:26, TommiT wrote:

I assume you mean something like this:

struct S
{
     private T _t;

     ref T get() { return _t; }

     void set(T t) { ... }
}

The benefit of the above type of coding versus having a public T
variable, is that you can change the implementation of S without
changing S's interface. Perhaps I would like to change it to this (or
whatever):

private static T[5] tees;

struct S
{
     private byte _idx;

     ref T get() { return tees[_idx]; }

     void set(T t) { ... }
}

Sure, but I think that's what properties are for. We currently don't have that in D but I think it would be great if fields could be exchanged with methods without breaking the API.

--
/Jacob Carlborg

Reply via email to