Does optional positioned arguments supported?

I see optional labeled arguments in docs, but not positioned argument.

And I found the option<int> is work, like: type add = (int, option<int>) => int

But when I call this function, I need provide None explicit:

add(2, None)

Is it right?

Hi @thomaszdxsn
I think positional arguments can not be optional.
eg:

let f = (x, y = ?, z) => x + z

f(1,2)

In the above case language could not decide if

  • 2 should be applied to y and wait for z.
  • or 2 should be applied to z and execute function f

To answer your question, yes add(2, None) None has to be provided explicitly in your case.

1 Like