Type inference for default function / method arguments?

rikki cattermole rikki at cattermole.co.nz
Tue May 11 13:54:14 UTC 2021


On 12/05/2021 1:43 AM, Andrei Alexandrescu wrote:
> On 5/10/21 4:01 PM, SealabJaster wrote:
>> On Monday, 10 May 2021 at 18:50:02 UTC, Witold Baryluk wrote:
>>> Hi,
>>>
>>> using D for very long time.
>>
>> While not an exact solution, aliases can be a little useful here.
>>
>> ```d
>> import std.typecons : Flag;
>>
>> // Shorten the names as much as you need of course.
>> alias Verbose = Flag!"verbose";
>> alias VeryVerbose = Flag"veryVerbose";
> 
> That's an antipattern. The very point of Flag is to allow avoiding 
> polluting the namespace and docs with such silly names.
> 
> Similarly, you wouldn't define an alias for every Tuple you use.

Once named arguments is implemented we can get rid of this crutch.

Binary Flag needs to go!


More information about the Digitalmars-d mailing list