DIP1000: Walter's proposal to resolve ambiguity of ref-return-scope parameters

Paul Backus snarwin at gmail.com
Thu Nov 25 15:59:41 UTC 2021


On Thursday, 25 November 2021 at 15:27:20 UTC, Imperatorn wrote:
> On Thursday, 25 November 2021 at 15:05:55 UTC, zjh wrote:
>> On Thursday, 25 November 2021 at 14:40:09 UTC, Dennis wrote:
>>
>>> I don't consider that clean.
>>
>> I usually use `C++`,`C++` has no similar `scope`,`C++` has 
>> `RAII`.
>> It's like the `&` of `C++` versus the `ref` of `d`. `&` is 
>> much simpler than `ref`.
>> It would be nice if `d` had some `symbols/sugar syntax` to 
>> simplify these attributes.
>
> I wonder what the reason was to choose ref instead of &. Maybe 
> it's kinder to the parser.

If you are new to D and don't already know C++, `int&` will mean 
nothing to you, whereas you have at least a chance of guessing 
what `ref int` means just from reading it.


More information about the Digitalmars-d mailing list