Keyword arguments of functions can't be skipped?

def demo(a, b = 1, c = 2) {
    print("${a} ${b} ${c}")
}

workflow {
    demo(1, c = 3)
}

In this example code, the output is 1 3 2 instead of the expected 1 1 3, so it appears the value I’m trying to assign to c is being assigned to b instead. Do keyword arguments work in Nextflow?

That syntax isn’t supported in Groovy. You can have “named args” like demo(1, c: 3), but named args are collected into a map and passed as the first argument, so you would need to define your function like so:

def demo(opts, a) {
  b = opts.b ?: 1
  c = opts.c ?: 2
  print("${a} ${b} ${c}")
}

I’m interested in doing something like keyword args like you suggested, because it’s more intuitive than Groovy’s named args, but that is just an idea at this point