Summary of issue:
Context in this proposal and the 2026-07-16 open discussion minutes. See the proposal for a working definition of syntactic parameters (vs. semantic).
Also please note the syntax of the default values for de-structured member variables is discussed in the proposal and also in leads question #7530.
Given this function that provides default values for fields inside the de-structured second parameter:
fn A(index: i32, {key: i32 = 0, value: i32 = 0});
The question is if a call that omits the second argument entirely, such as:
Should compile without error, or should we require the programmer to specify that we accept an absent struct with an additional = {} as a default value on the second parameter, as in alternative B here:
fn B(index: i32, {key: i32 = 0, value: i32 = 0} = {});
Also note that the B alternative presupposes we would accept {} as a valid match to a struct function parameter with default values for every indicated member, meaning that this call would compile successfully:
Details:
Note that we do not allow, currently, the following:
A(3, {.something_else = 42}); // ERROR
With the reasoning that there is already syntax to allow other members in the struct, using the , _ from in the parameter:
fn C(index: i32, {key: i32 = 0, value: i32 = 0, _});
Which would then allow example 3 to compile.
Any other information that you want to share?
No response
Summary of issue:
Context in this proposal and the 2026-07-16 open discussion minutes. See the proposal for a working definition of syntactic parameters (vs. semantic).
Also please note the syntax of the default values for de-structured member variables is discussed in the proposal and also in leads question #7530.
Given this function that provides default values for fields inside the de-structured second parameter:
The question is if a call that omits the second argument entirely, such as:
Should compile without error, or should we require the programmer to specify that we accept an absent struct with an additional
= {}as a default value on the second parameter, as in alternativeBhere:Also note that the
Balternative presupposes we would accept{}as a valid match to a struct function parameter with default values for every indicated member, meaning that this call would compile successfully:Details:
Note that we do not allow, currently, the following:
With the reasoning that there is already syntax to allow other members in the struct, using the
, _from in the parameter:Which would then allow example 3 to compile.
Any other information that you want to share?
No response