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

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 23 16:15:07 PST 2016


On Thursday, 24 November 2016 at 00:04:51 UTC, Tofu Ninja wrote:
> On Wednesday, 23 November 2016 at 23:21:53 UTC, ketmar wrote:
>> On Wednesday, 23 November 2016 at 23:02:30 UTC, Tofu Ninja 
>> wrote:
>>> Being able to get an alias to (ref int) seems like a bug.
>>
>> you are unable to alias it, `ref` will be erased on aliasing. 
>> the only way to retain it is to have a tuple with it. that 
>> trick aliases *function* *argument* *tuple*, not a single type.
>>
>> yeah, `ref` is very special beast. but it is still type 
>> modifier. ;-)
>
> Unless I can write "alias refint = ref int;", this should not 
> be a feature at all... how did anyone think this is a good 
> idea. Seriously I used to love D but now it's just a mess of 
> hacks...

either this, or you won't be able to replicate function with it's 
exact args; you won't be able to even check if some arg is ref.

but not having `ref int` as a valid type declaration has it's 
reasons.


More information about the Digitalmars-d-learn mailing list