 Add hint that float can't be nan or inf
It would be nice to have a way to indicate that a function's float parameter may never be NaN or Inf, and throw an exception when that is the case. Currently I am doing this using a lot of extra lines in the function bodies, but I feel like this would make a good feature in Angelscript's declarations itself.I'm not sure what the syntax would be, but maybe some keyword similar to “const”, maybe “finite”?void SomeFunction(finite float x) { .. }Does any other language have something like this that can be inspired from?
This could be thought of a simple function contract. There are several languages that support function contracts as can be seen in this wikipedia article . Although C++ doesn't as far I know there is a proposal for it, so it might be available in a future version. I've included your suggestion in my to-do list for future reference, but there are so many other things I want to do before coming to something like this.