DIP28, on properties, availabel for destruction as well

Artur Skawina art.08.09 at gmail.com
Thu Feb 28 06:29:21 PST 2013


On 02/28/13 14:33, angel wrote:
> Possibly setters had better have 'void' as their return type.
> Then
>     auto a = b.setter = 3;
> will have the predictable behavior with both 'a' and 'whatever b-setter sets' being set to 3. Otherwise, it might be totally unpredictable.
> 
> On the other hand, possibly setters MUST return a value of the same type they accept, in order to be able to emulate standard-like behavior.
> 
> When I re-read it, the 1-st option looks cleaner.
     
    ...
       long setter(long v) @property;
    ...
    auto a = b.setter = 3;

    // and there's no reason to disallow:
    long setter(ubyte v) @property;
    long setter(T:long)(T v) @property;
    long setter(U)(U v) @property;
    // etc

artur


More information about the Digitalmars-d mailing list