[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is there similar autospeccing thing in lemock?
- From: Volodymyr Bezobiuk <dedoogun@...>
- Date: Wed, 13 Aug 2014 18:19:35 +0200
Python's functions can be introspected and you can extract such things like number of arguments to call the function, consts inside the function and variable names and so on. Python uses function signatures and it's a runtime exception if you call function defined to use 3 arguments with only 2 arguments (Python semantics is quite strict comparing to Lua semantics). In Lua on the other hand it is ok to call any funciton with any number of arguments so given a Lua function you have no way to introspect with how much arguments it was defined. So, i don't think you're technically able to automatically assert equality number of arguments passed and number of arguments in function definition without rude hacks (though it probably could be done with some code parsers but it's out of scope of your question actually).