The interaction of encapsulation and properties in D

Jacob Carlborg doob at me.com
Thu Jul 11 00:36:13 PDT 2013


On 2013-07-11 04:55, "Luís Marques" <luismarques at gmail.com>" wrote:

> A case where such reasoning would not apply is when source code
> compatibility is not enough, such as when you have a D library. But this
> could be solved by something like...
>
>      class X
>      {
>          @property public int phone;
>      }
>
> ...which would under the covers generate getter and setter properties,
> so that if you later wanted to encapsulate it without breaking binary
> compatibility you could do so.

I would really like to have this. It's like in Scala, all public fields 
are implemented with methods.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list