Type inference for default function / method arguments?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue May 11 13:43:26 UTC 2021


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.



More information about the Digitalmars-d mailing list