named arguments (C++) - Something D could learn from

Neia Neutuladh neia at ikeran.org
Wed Dec 19 16:13:27 UTC 2018


On Wed, 19 Dec 2018 15:07:48 +0000, JN wrote:
> On Wednesday, 19 December 2018 at 13:30:57 UTC, Kagamin wrote:
>> https://blog.jetbrains.com/dotnet/2018/11/27/inline-parameter-name-
hints-c-vb-net-resharper-rider/
>> resharper 2018 just overlays parameter names right in editor window.
> 
> I think there are two usecases that are kind of getting mixed here,
> correct me if I'm wrong. Named/keyword arguments provide two benefits:
> 
> 1) you know what the arguments mean at the call place
> 2) you can make optional arguments without making multiple function
> overloads or using something like the Builder pattern
> 
> This fixes 1) but doesn't fix 2)

D has optional arguments already, but the thing that reorderable named 
arguments can easily get you is not having to specify optional arguments 0 
through n-1 just to specify optional argument n.


More information about the Digitalmars-d mailing list