auto ref is on the docket

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 22 16:43:07 PDT 2015


On 06/23/2015 01:27 AM, kinke wrote:
> On Monday, 22 June 2015 at 23:04:14 UTC, Timon Gehr wrote:
>> On 06/23/2015 12:18 AM, kinke wrote:
>>>>> In C++ there's no problem with const&, so why they will be in D?
>>>>
>>>> Because const is transitive in D and therefore more restrictive.
>>>
>>> That's not a reason.
>>
>> Yes it is.
>>
>>> It's just an additional restriction imposed by D and only prevents
>>> you from using the proposed `in ref T`/`const auto ref T` *shudder*
>>> equivalents if const-transitiveness would be violated. In my
>>> day-to-day C++ work, I almost never have to do that.
>>
>> Note "almost".
> ...
> Care to share an example where transitive const is a problem apart from
> obvious lazily caching stuff?

One obvious problem ought to be enough. Some of the remaining cases are 
obvious as well. Others are not. One way to avoid non-obvious issues is 
to keep language features orthogonal.

> I don't think I've encountered any lately.

The problems with transitive const to be encountered in day-to-day C++ 
work are few.


More information about the Digitalmars-d mailing list