Hi

On 02.05.24 15:27, Larry Garfield wrote:
It's not just that it errors confusingly.  It's that the design as is would be 
incompatible with any C-based function.  A function that works with anything 
*except* the standard library seems... problematic.

It's possible that, since these new functions are C-based, we could do some 
extra detection to see if the function is unary or not, and pass only the value 
if it is.  I don't know if that is possible to do performantly in C, but it's 
definitely more of an option than if they were in user-space.  (Again, I don't 
know if this is the best solution, but it seems like a possible solution.)

I definitely get your point. However, there are not many standard functions that can be used there. The only functions I can think of that can be used there are `is_*` and maybe `strlen` (which has not a bool return type). I don't think that any internal functions are realistically passed there, but rather user-defined ones. I would therefore not make the function any more complicated than it already is. If the function works differently with internal functions than with user functions, this can also be very confusing for users.

Your suggestion in particular doesn't really solve the problem. This is because the problem would still exist with the intval function, for example. Two parameters are then also passed there, although the second one makes little to no sense there. And to decide for each function whether it makes sense or not …

The error message that too many parameters are passed is clear enough in my opinion. This is something that developers have to learn once (like many other things) and then the problem is solved. And even better, the problem is detected beforehand by a static analysis tool.

Cheers

Josh

Reply via email to