Getters/setters generator
Andrei Alexandrescu via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Tue Jan 17 01:12:43 PST 2017
On 1/17/17 8:26 AM, Eugene Wissner wrote:
> On Friday, 9 December 2016 at 18:53:55 UTC, Andrei Alexandrescu wrote:
>>
>> Love it, and was toying with similar ideas too. One good extension is
>> to add a predicate to the setter, which guards the assignment. -- Andrei
>
> What kind of predicate do you mean? Can you give an example please?
Say you have a property "percent". The setter should do an enforce(value
>= 0 && value <= 100) before the assignment. -- Andrei
More information about the Digitalmars-d-announce
mailing list