albertodemichelis / squirrel

Official repository for the programming language Squirrel
http://www.squirrel-lang.org
MIT License
926 stars 161 forks source link

Checking for minimum/maximum number of native closure parameters #288

Open Vankata453 opened 4 months ago

Vankata453 commented 4 months ago

The sq_setparamscheck function, instead of accepting just the SQInteger nparamscheck parameter, now accepts both SQInteger nparamscheckmin and SQInteger nparamscheckmax.

Those define the minimum/maximum for the parameters number check policy. Setting any of them to 0 or negative disables the respective check.

I believe this change makes the parameter check way less restrictive and suitable for more use-cases. For example, it enables support for default arguments.


NOTE: This change makes changes to the API functions sq_setparamscheck and sq_getclosureinfo. I am not sure how Squirrel handles such changes (deprecation mechanic?). Because of this, I understand that this change might not be suitable for upstream.