Hacker News new | ask | show | jobs
by bnert 1013 days 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.

1 comments

So it basically does

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