DIP 1019--Named Arguments Lite--Final Review
H. S. Teoh
hsteoh at quickfur.ath.cx
Sat Aug 24 00:29:42 UTC 2019
On Fri, Aug 23, 2019 at 11:41:21PM +0000, Yuxuan Shui via Digitalmars-d wrote:
> On Friday, 23 August 2019 at 16:47:14 UTC, H. S. Teoh wrote:
[...]
> > Exactly the same objections I have against this DIP. OT1H it's
> > trying to get named arguments into the language, but OTOH it takes
> > out what I would consider to be two of the most important reasons to
> > *have* named arguments: skipping default parameters, and
> > out-of-order argument passing. Therefore, it essentially nullifies
> > its own raison d'etre.
>
> It DOES NOT prevent them from being added later. Like I have already
> reiterated multiple times, this is not the be-all and end-all named
> arguments DIP.
And that's exactly the problem: this DIP wants to introduce named
arguments, but proposes a subset of functionality so weak that doesn't
even offer what I consider to be two *major* advantages of having named
arguments. Which begs the question, why even bother? Why not just take
us all the way there and do a full DIP of the "be-all and end-all" of
named arguments?
[...]
> > Furthermore, if this DIP hadn't shot itself in its own foot by not
> > allowing out-of-order argument passing and skipping default
> > parameters, then it would have actually made overly-long parameter
> > lists actually *acceptable*, in the sense that the function could
> > just supply default values for most of the parameters, and the
> > caller can just name and pass the few arguments that it wants to be
> > different from the defaults, and the rest don't have to be
> > explicitly specified.
>
> It does not always make sense to supply default values for parameters.
>
> e.g createWindow(int width, int height)
>
> What default value do you give them?
[...]
Then don't give them any defaults. What makes you think you have to?
T
--
Without geometry, life would be pointless. -- VS
More information about the Digitalmars-d
mailing list