torch / argcheck

A powerful (and blazing fast) argument checker and function overloading system for Lua or LuaJIT
Other
54 stars 17 forks source link

Fails when default and no type #5

Open nkoumchatzky opened 9 years ago

nkoumchatzky commented 9 years ago

This fails with an assertion error:

local testCheck = require('argcheck'){
   {name="formats", default=10, help="authorized formats"},
}

Am I missing something?

andresy commented 9 years ago

argcheck does not support the absence of type=" ... "

in general it is not a good idea, because it creates confusion or ambiguous situations, especially if you overload the function.

should you want to do this, you can tweak argcheck.env.istype() such that it deals with (for example) type="*"

nkoumchatzky commented 9 years ago

Thanks for answering @andresy ! The README says "The type field is optional (even though it is highly recommended!)", which is why I expected this to work. Could you update the README?