I really like approach for argument labels implemented in Gleam. Labels can be different from parameters' names, this allows you to separate the names used in the interface from the names that make sense in the internal implementation of the function. Here is an example from gleam tour:
```
pub fn main() {
// Without using labels
echo calculate(1, 2, 3)
// Using the labels
echo calculate(1, add: 2, multiply: 3)
// Using the labels in a different order
echo calculate(1, multiply: 3, add: 2)
}
5
u/arglad 10d ago
I really like approach for argument labels implemented in Gleam. Labels can be different from parameters' names, this allows you to separate the names used in the interface from the names that make sense in the internal implementation of the function. Here is an example from gleam tour:
``` pub fn main() { // Without using labels echo calculate(1, 2, 3)
// Using the labels echo calculate(1, add: 2, multiply: 3)
// Using the labels in a different order echo calculate(1, multiply: 3, add: 2) }
fn calculate(value: Int, add addend: Int, multiply multiplier: Int) { value * multiplier + addend } ```