Is there a bug with scale.factor? (Typst 0.15.1)

Tested on the latest Typst (0.15.1):

#scale(factor: 110%)[Foo]

I get an error:

Unexpected argument: factor

The factor parameter exists in the doc: Scale - Typst Documentation

Is this a bug? Should I file an issue?

The factor argument is positional:

factor

The scaling factor for both axes, as a positional argument. This is just an optional shorthand notation for setting x and y to the same value.

It should probably be marked more explicitly with the grey positional label, like calc.abs.value and similar

related issue: Documentation inconsistency: `page.body` (and `text.body`) behave as required positional parameters but are not documented as such · Issue #7580 · typst/typst · GitHub

Thanks. Yes I don’t know why the doc didn’t put the positional label. This is especially confusing since factor has a default value. I didn’t know you could have default values for positional arguments. I don’t even know how to implement that.

It’s not possible for user-defined functions. In this example, scale.factor is defined here:

There’s no syntax to make it easy but it’s possible with an ..args sink:

#let f(a: 1, ..args) = {
  let b = args.pos().at(0, default: 2)
  [a: #a, b: #b]
}

#f(a: 3, 4)

#f(a: 3)

image