Getters/setters generator

Andrei Alexandrescu via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Jan 17 01:17:56 PST 2017


On 1/17/17 9:32 AM, Eugene Wissner wrote:
> Ah, well thanks. I don't think it makes much sense since it would be
> easier to write a complete setter if the user needs extra checks.
> Accessors are there only for the generation of the standard methods,
> that just get or set some object property.

Hmmm... that's a bit of a bummer because it helps only the degenerate 
case (accessors are there as placeholders for future extensions, and 
otherwise offer no protection whatsoever compared to a public value). 
The question would be then what would be use cases for the accessors. 
Predicated setters are not just a random thing one might want out of 
many possibilities, it's a frequent pattern. -- Andrei


More information about the Digitalmars-d-announce mailing list