microsoft / microsoft/typespec
Named-only arguments in templates
Open
design:needed
triaged:core
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
Given that our implementation of named template parameters largely mirrors Python, one feature we discussed but chose not to implement is the concept of named-only arguments:
https://peps.python.org/pep-3102/
**Python Syntax**
`def foo(a, b=1, * c="cat")`
Here `a` and `b` can be supplied positionally _or_ by name, but `c` can only be supplied by name. The `*` character in the argument list delineates the positional-or-named arguments from the named-only arguments, and the named-only arguments must come at the end of the signature.
Contributor guide
Assessment
This issue has not been assessed yet.