Closed
Description
The current pattern of having unnamed-positional-required and named-optional parameters is not very flexible and has a few shortcomings.
Other languages such as Python or C# allow all parameters to be named and optional. There are just rules around when they become optional or how to use them as positional or named parameters.
Here are some ideas on how this could look like:
- All parameters are required by default
- Parameters can be made optional by providing a default value
- Optional parameters come last (not sure if this has to be a requirement, but seems sensible)
- All parameters can be used as positional parameters, but have to be in the order they appear in the method declaration
- All parameters can be used as named parameters
- Positional parameters can also be used with their name for documentation purposes (not sure if this is possible or if named parameters have to come last, but seems like a nice feature to be able to use the name for documentation when passing in bools, numbers or string literals)