top | item 37499247

(no title)

bnert | 2 years ago

Arity explanation: https://en.wikipedia.org/wiki/Arity

From the blurb you quoted, it sounds like Lua doesn't check function argument arity natively, and fennel can. This means that fennel applies a runtime check to validate if a function was called with an expected arity, and if not, propagates an error (however Lua does that, I do not know), hence why arity checked functions are not as performant.

discuss

order

nmz|2 years ago

So it basically does

  function M(...)
    if select("#",...)>3 then
      error("failed arity check on M()")
    end
  end