DIP26: properties defined
Robert
jfanatiker at gmx.at
Sat Feb 9 03:57:46 PST 2013
As you can't actually encapsulate the array with free functions just do:
ref T front(T)(T[] arr);
There is no value in using an actual setter.
If you really want encapsulation, just do:
struct EncapsulatedArray(T) {
T front() @property;
void front(T value) @property;
private T[] arr_;
}
On Sat, 2013-02-09 at 12:43 +0100, FG wrote:
> On 2013-02-09 12:32, Robert wrote:
> > Has anyone actually read the DIP?
> >
> > Simply don't call it property.
>
> Fine for getters but this time it will break things for setters:
>
> @property void front(T)(T[] arr, T elem) {...}
>
> and either all code with assignments would have to be changed
> or assignments remain allowed for functions -- neither is good.
>
More information about the Digitalmars-d
mailing list