microsoft / microsoft/typespec

Named-only arguments in templates

Open
#2,327 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.