http://wiki.dlang.org/DIP25

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 29 08:09:00 PST 2014


On 12/29/14 10:51 AM, Andrei Alexandrescu wrote:
> On 12/29/14 6:07 AM, Steven Schveighoffer wrote:
>> On 12/27/14 10:09 PM, Andrei Alexandrescu wrote:
>>> Walter and I have been working on revamping DIP25, which focuses on
>>> tightening the screws of ref. This should then simplify DIP69
>>> significantly.
>>>
>>> Please comment: http://wiki.dlang.org/DIP25
>>
>> ref int hun() inout { return b; }
>>
>> This doesn't make sense. inout cannot cast to mutable.
>
> Yah, the DIP should clarify that new behavior. Thanks. -- Andrei

Huh? This behavior cannot be allowed.

If we can return mutable ref to a member when calling a member function 
on a const or immutable object, then we are in violation of const.

What is the point of the above? in such a function, what is typeof(this)?

Even if you can make up rules to make this sane, it's going to be 
boatloads more confusing than today's situation with inout.

-Steve


More information about the Digitalmars-d mailing list