Brainstorming: Explicit instantiation of function template with `auto ref` parameters

Paul Backus snarwin at gmail.com
Mon Feb 24 16:42:46 UTC 2025


On Monday, 24 February 2025 at 16:30:59 UTC, M. M. wrote:
> On Monday, 24 February 2025 at 13:50:07 UTC, Paul Backus wrote:
>> On Monday, 24 February 2025 at 00:24:03 UTC, Manu wrote:
>>> Just yet another in the endless stream of cases why ref 
>>> should be part of
>>> the type and not a 'storage class'! Literally everything ref 
>>> touches gets
>>> more complex than it should.
>>> *🎉*
>>
>> +1000
>>
>> The consistent, principled way to bring ref into the type 
>> system would be to assign all lvalue expressions a type of 
>> ref(T), and all rvalue expressions a type of T, with an 
>> implicit ref(T) -> T conversion for copyable T.
>>
>> Unfortunately this is not really feasible for D, since it 
>> would be an enormous breaking change. But anyone designing a 
>> new language should consider this approach.
>
> not even with the editions coming? . . .

Nope. Even with editions, some changes are simply too disruptive.


More information about the Digitalmars-d mailing list