How to declare function with the same call signature as another?

Tofu Ninja via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 23 15:02:30 PST 2016


On Wednesday, 23 November 2016 at 22:48:17 UTC, ketmar wrote:
> On Wednesday, 23 November 2016 at 22:28:57 UTC, Tofu Ninja 
> wrote:
>> On Wednesday, 23 November 2016 at 22:19:28 UTC, ketmar wrote:
>>> On Wednesday, 23 November 2016 at 22:14:25 UTC, Tofu Ninja 
>>> wrote:
>>>> What is a (ref int)? A tuple with "ref int" as its only 
>>>> member? Since when is ref int a type?
>>>
>>> it is "type with modifier", like "const int" or "immutable 
>>> int".
>>
>> Since when has ref been a type qualifier? It has always been a 
>> parameter/function attribute.
>
> which is technically type qualifier. it just forbidden (in 
> grammar) to use it anywhere except arg declaration.

Maybe the compiler sees it as a type qualifier, but it is not 
listed as a type qualifier and does not behave like a type 
qualifier in any sense. For example typeof will never return "ref 
int" but will return "const int", auto will never infer ref but 
can infer const, you can pass const(int) into a template but can 
never pass ref(int) into a template(even with that hack I posted 
before, the ref gets striped).

Being able to get an alias to (ref int) seems like a bug.


More information about the Digitalmars-d-learn mailing list