DIP 88: Simple form of named parameters

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 25 08:17:27 PST 2016


On Mon, 25 Jan 2016 12:56:01 +0000, arturg wrote:

> On Monday, 25 January 2016 at 08:55:55 UTC, Jacob Carlborg wrote:
>> On 2016-01-24 19:23, Chris Wright wrote:
>>
>>> It shouldn't. However, it is another way to pass function arguments,
>>> so for thoroughness it would be better to mention it.
>>
>> Added an example.
>>
>>> Is this what you intended? If so, please document it so other
>>> reviewers don't have to wonder.
>>
>> Added an example.
> 
> hi, named args is mainly a feature for the caller, is it really
> necessary to add a new syntax to the function definition? besides making
> some args part of the api and some not.

Python, C#, Scala, and Ada do not require any special annotations at the 
function definition to use named arguments. Dart and Ruby do.

Obviously it's not necessary, but there is precedent both ways.

> this feature is nothing more then a comment and the simplest way to
> implement this, is to add a single word comment type which might be
> usefull in more situations.

It's a comment that the compiler verifies. You could argue that the bulk 
of the type system is comments that the compiler verifies.


More information about the Digitalmars-d mailing list