DIP1000: Walter's proposal to resolve ambiguity of ref-return-scope parameters
russhy
russhy at gmail.com
Sun Nov 28 01:20:00 UTC 2021
On Saturday, 27 November 2021 at 18:27:43 UTC, Walter Bright
wrote:
> On 11/27/2021 3:10 AM, Nick Treleaven wrote:
>> On Saturday, 27 November 2021 at 01:10:37 UTC, zjh wrote:
>>> `C++` references, which look complicated, are actually simple.
>>
>> Try reading the C++ spec, you will see the rules are far more
>> complicated than D `ref`.
>
> C++'s & for ref is part of the type system, but it is such a
> special type that it messes with every aspect of the type
> system.
>
> This comes about because & can only appear at the "head" of a
> type (a "pointer to ref to int" cannot be declared), and there
> are many, many rules saying when the ref type is significant
> and when it is skipped.
>
> D made the better decision to have `ref` be orthogonal to the
> type.
i can see understand that point
i personally stick to pointers only in my codebase, because i
like simplicity, i didn't even use & back when i was using C++,
it always felt dirty anyways
More information about the Digitalmars-d
mailing list