Closed nfisher1226 closed 3 years ago
an example of the issue and workaround in the documentation.
Yea, maybe a good idea. It might also be possible to just set the eval quota inside parseParam
to something high (the quota is only there to prevent infinite loops, which we have none of. I'll look into it later :+1:
It might also be possible to just set the eval quota inside parseParam to something high
I thought of that. Only problem I see is you're then locking in that value, so if somebody tried to go over it that's a failure point. It also makes the function comptime only, but that's probably fine.
Seems we can indeed set the eval branch quota inside parseParam
. The problem is that you probably can't override it from outside anymore, so we have to choose a very good default (std.math.maxInt(u32)
is an option 🤔). Also, this does not make the function comptime only.
I guess since this library is not 1.0.0
we can play around, so I might just push a change that sets the eval quota to something large. It can be removed later in a breaking change if that turns out to be a bad idea.
Would it be possible to make it an optional parameter to the function? Then if it's passed in a null, it uses the sensible default.
I've managed to work around this by enclosing all of the comptime in a named block and setting the quota within.
This works but is less than ergonomic and requires finding a workaround by the use of the library. Not sure if there's a way to fix it within zig-clap, but at the least I would suggest showing an example of the issue and workaround in the documentation.