DIP Draft Review News
Yuxuan Shui
yshuiv7 at gmail.com
Mon Jun 4 10:39:03 UTC 2018
On Monday, 4 June 2018 at 10:30:18 UTC, rikki cattermole wrote:
> On 04/06/2018 10:05 PM, Yuxuan Shui wrote:
>> On Monday, 4 June 2018 at 05:46:04 UTC, rikki cattermole wrote:
>>> [...]
>>
>> Not sure what you meant? This definitely does not error out:
>> https://godbolt.org/g/PAiFPw
>
> ```D
> @named:
> int add(int a, int b);
> int add(int b, int a) {
> assert(a > 0);
> return a + b;
> }
>
> void main() {
> add(2, 0);
> }
> ```
>
This shouldn't fail to compile. I think it's made clear in the
DIP, parameter names play no role in overload resolution.
>>>[...]
>>
>> Care to elaborate why? In this DIP, name prefix on caller side
>> is optional, caller is allowed to leave out any number of
>> argument names if they want.
>
> Not all parameters should be used as named arguments. Two
> syntax's one purpose isn't desired, which the DIP currently
> encourages.
Why is this two syntaxes one purpose?
>
> Personally I want to keep named and unnamed completely separate
> and focus more upon public API.
>
>
>
> While I'm not keen on 2 and definitely would love for 3, my
> first point is what will determine if I vote yes or not
> (assuming it gets there). My instincts are saying that it
> simply hasn't been thought through enough just yet and that
> there will be some real trouble with it.
I've dwelt on this for a couple of months now, and keeping
thinking on it myself is not going to help. That's why I'm asking
for feedback.
>
> Ambiguity is nobody's friend when it comes to programming
> language proposals. You have time to think it over, and I could
> be very wrong (of course); but other wise as a lite version of
> named arguments its not a bad DIP, just maybe we can do better
> for D ;)
More information about the Digitalmars-d-announce
mailing list