flux
flux copied to clipboard
SPEC: keyword expansion
From ifql created by mark-rushakoff : influxdata/ifql#356
We don't need keyword expansion for MVP of the spec, but I wanted to raise the topic in case it's worth keeping in a later version and we need to reserve an operator now.
Keyword expansion allows the use of objects in place of writing out literal keywords in function arguments.
y = (m, x, b) => m * x + b
// Instead of:
y(m: 1, x: 3, b: 5)
// You can construct an object and use it directly:
args = {m: 1, x: 3, b: 5}
y(*args) // or y(**args), or y(args), or something else
We would also need to decide behavior when keys are missing or when too many keys are present. Or we can decide not to support keyword expansion, and then that decision will have been documented.