Aliases as Properties

Jarrett Billingsley jarrett.billingsley at gmail.com
Mon Jul 27 16:49:48 PDT 2009


On Mon, Jul 27, 2009 at 7:33 PM, escalan<escalan at gmail.com> wrote:
> Hi, I'm new here. A simple idea I've had is to simply use aliases for defining properties.
>
> If you allow writing aliases as expressions, you have get properties. Then a simple extension to the syntax would also allow for writing set properties.
>
> alias (a) property;
> alias (a = n) property(n);
>
> foo(property); // Get
> property = 32; // Set
>
> This virtually eliminates any problems with properties, and it doesn't require any new keywords. It won't break existing aliases either.
>

Except if you want to do anything more complex in your setter/getter
than a simple expression.



More information about the Digitalmars-d mailing list