Open
Description
Issue description:
So I've recently been using named parameters a lot more:
SomeFunction(7, .option = 9);
If you don't know, this is a way to only specify specific optional parameters instead of all of the preceding ones:
SomeFunction(7, 0, 5, 1, 9);
Even if you use _
as "default" it is still a bit unwieldy:
SomeFunction(7, _, _, _, 9);
Anyway, this isn't to talk about call sites, but declaration sites:
SomeFunction(parameter, first = 0, second = 5, third = 1, option = 7)
{
}
It would be nice to extend the .
syntax to here as well to make parameters that can only be called via named parameter syntax:
SomeFunction(parameter, .first = 0, .second = 5, .third = 1, .option = 7)
{
}
This gives library writers way more flexibility in their optional arguments as they are no longer bound to a specific order, as people can no longer call the function with only positional arguments.
Metadata
Metadata
Assignees
Labels
No labels