`ref T` should be a type!!
Walter Bright
newshound2 at digitalmars.com
Mon Apr 1 00:16:46 UTC 2019
On 3/31/2019 3:48 PM, Manu wrote:
>> Even in C++ despite of all its silliness, T& is a type and can be
>> used as a template argument.
>>
>> Can the language be changed to resolve this problem?
>
> 1. I couldn't possibly agree with you more!!! Sadly that's not how it is.
Although ref can be captured with C++ templates, it isn't really a type. For
example, you cannot create a pointer to a ref. Furthermore, the spec for it is
crammed with wacky special cases to make it behave like a storage class instead
of a type. I defy anyone to give a list of cases when C++ ref is inferred and
when it is not, and if anyone did, I'm sure it would be wrong. Yes, it's that bad.
> Writing that code is like stabbing myself in the hands with rusty
> forks...
I'm convinced that if C++ ref didn't exist, and we added it to D, you'd hate it :-)
> I feel emotionally unstabilised, but it can solve your
> problems in various applications.
Please show a use case. I can't think of one.
More information about the Digitalmars-d
mailing list