#3726·just

Support variadic `*args` and `+args` in user-defined functions

Author: pygarapCreated Sep 28, 2026Updated Sep 29, 2026

Summary

Please support variadic parameters in user-defined functions, matching the existing recipe syntax. This would let reusable helpers accept varying numbers of arguments without requiring an explicit list at every call site.

Proposed behavior

  • Allow one final variadic parameter after any fixed parameters: *args accepts zero or more arguments, while +args requires at least one.
  • Collect the remaining arguments in order, using a space-separated string normally and a list with set lists, consistent with recipe parameters.
  • Report an error when a call omits required arguments.

Usage

Proposed syntax:

just
set unstable
set lists

greet(greeting, +names) := greeting + ", " + join_list(names, " and ") + "!"

@hello:
  echo '{{ greet("Hello", "World") }}'
  echo '{{ greet("Hello", "Alice", "Bob") }}'

Expected output:

bash
$ just hello
Hello, World!
Hello, Alice and Bob!

Here, greeting receives the first argument, and names collects the remaining arguments. Calling greet("Hello") would fail because +names requires at least one argument.

References