Return by 'ref' problems...

Jakob Ovrum jakobovrum at gmail.com
Fri May 4 05:24:33 PDT 2012


On Friday, 4 May 2012 at 11:49:44 UTC, Jacob Carlborg wrote:
> On 2012-05-04 12:09, Manu wrote:
>
>> Ah, of course! I didn't spot that >_<
>> Thanks.
>>
>> I suppose technically, 'ref' can lead to the same ambiguity. 
>> This must
>> be the core of the problem. ref needs to be supported with 
>> parentheses?
>
> I'm not sure, since you can't declare a variable as "ref" I 
> think the syntax should work. But the syntax with parentheses 
> should probably work as well, to be consistent with "const".

Const can be used with parentheses because it is also a type 
qualifier in addition to a storage class (for syntactic 
purposes). All of const, immutable and shared have this dual 
syntactic existence.

'ref' has several meanings depending on context, but it is never 
a type qualifier.

I think conflating the syntax for the two would mostly bring 
confusion.


More information about the Digitalmars-d mailing list