DIP 1019--Named Arguments Lite--Final Review
Jonathan M Davis
newsgroup.d at jmdavisprog.com
Sat Aug 24 05:16:01 UTC 2019
On Friday, August 23, 2019 11:00:06 PM MDT a11e99z via Digitalmars-d wrote:
> On Saturday, 24 August 2019 at 01:43:31 UTC, Newbie2019 wrote:
> > On Saturday, 24 August 2019 at 01:26:48 UTC, H. S. Teoh wrote:
> >> Without these two primary benefits, it's hard for me to
> >> imagine how this DIP could pull its own weight. It's like
> >> promising to cook chicken pot pie, but when the dish arrives
> >> there's only pie and no chicken. Who would pay for that?
> >
> > I agree.
> >
> > Without reordered and skipping default, I consider
> > in-place-inited struct is more useful then this DIP.
>
> struct is only one entity, so compiler knows what exactly
> initialized
> but function can be overloaded
> so which one should be called in sample below?
>
> import std.stdio;
> void foo(int a, int b) {writeln("0");}
> void foo(int b, double a) {writeln("1");}
> void main()
> {
> foo(b: 10, 0);
> }
The simple answer is to just make it illegal to mix named arguments with
normal arguments. If you use a name with one of them, you have to use a name
with all of them.
- Jonathna M Davis
More information about the Digitalmars-d
mailing list