On the subject of properties, and possibility of having them in the library
Timon Gehr
timon.gehr at gmx.ch
Sun Jan 27 00:49:43 PST 2013
On 01/27/2013 12:23 AM, Simen Kjaeraas wrote:
> On 2013-23-26 20:01, Timon Gehr <timon.gehr at gmx.ch> wrote:
>
>> On 01/26/2013 03:41 PM, Simen Kjaeraas wrote:
>>> While the storm raged, I decided to try implementing properties as
>>> library types. I encountered a few obstacles, which I will outline here.
>>>
>>> First, my intended syntax:
>>>
>>> class A {
>>> int _n;
>> mixin Property!(
>>> () => _n,
>>> value => _n = value
>>> ) n;
>>> }
>>> ...
>>
>>
>> http://d.puremagic.com/issues/show_bug.cgi?id=7653
>
> And how might that work?
>
>
It wouldn't work so well. I think there is no way to get what you want,
because the type of a.n would need to be 'int', and so there is no way
to hook in the setter.
More information about the Digitalmars-d
mailing list