Discussion Thread: DIP 1030--Named Arguments--Final Review

Jonathan M Davis newsgroup.d at jmdavisprog.com
Fri May 15 19:41:14 UTC 2020


On Wednesday, May 13, 2020 11:19:21 PM MDT Walter Bright via Digitalmars-d 
wrote:
> On 5/13/2020 12:31 PM, Steven Schveighoffer wrote:
> > On 5/13/20 3:30 PM, Walter Bright wrote:
> >> In D, we do:
> >>     void copy(string, string destination);
> >
> > And how does the implementation of copy use that first parameter?
>
> ----- test.di -----
> void copy(string, string destination);
>
> ----- test.d ------
> void copy(string src, string destination)
> {
>      ...
> }

In general, .di files are an antipattern that just causes problems. They're
necessary in some cases, but they don't work at all with templates (and of
course, a lot of idiomatic D code is templated) and are problematic with
stuff like auto return types. I'd be tempted to start using .di files
everywhere to prevent having to deal with anyone using named arguments with
any library I wrote, but it would make the code extremely painful to
maintain in comparison and simply wouldn't work for a lot of code.

- Jonathan M Davis





More information about the Digitalmars-d mailing list