Getters/setters generator

Eugene Wissner via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Dec 11 07:38:22 PST 2016


On Sunday, 11 December 2016 at 03:15:55 UTC, Mike Bierlee wrote:
> On Sunday, 11 December 2016 at 02:17:18 UTC, Mike Parker wrote:
>> On Saturday, 10 December 2016 at 20:25:05 UTC, Mike Bierlee 
>> wrote:
>>> On Friday, 9 December 2016 at 10:27:05 UTC, Eugene Wissner 
>>> wrote:
>>>> It would generate 2 methods "num": one to set num_ and one 
>>>> to get its value.
>>>
>>> It would be great if you could generate @properties instead. 
>>> I like the more natural way of accessing those instead of 
>>> getters/setters.
>>
>> What are properties if not "getters" and "setters"? From the 
>> original post: "It would generate 2 methods "num": one to set 
>> num_ and one to get its value."
>>
>> Two methods named "num". No "get" or "set" in sight.
>
> I was under the impression that you could only access methods 
> as if they were fields using the @property attribute. After 
> carefully reading the documentation I see this is not the case 
> (UFCS does this). Still there are some added benefits from 
> using @property to completely threat them as fields. It would 
> be nice if you could add @property to the generated 
> getters/setters.

Yeah, I see, @property seems to bring some additional features. 
Will think about it. Thanks.


More information about the Digitalmars-d-announce mailing list