Closed mtdowling closed 10 years ago
Updated so that function argument type mis-matches return null rather than raise an error.
Sounds good to me. Feel free to modify the PR as needed.
Now that I've implemented just about all of this JEP and have had time to experiment with this new functionality, I have a few comments, some of which I've started to collect in my own branch:
null
on argument type mismatch can be hard to troubleshoot. For simple cases, it's not too bad, but for complex expressions (and given that functions are expressions themselves so they can also be nested) it's hard to track down where a null
originates from, especially because a null
will propagate through subsequent function expressions. For example, given foo(bar(baz(@), other), other2)
, it's hard to figure out which argument triggered the null
. I haven't implemented this, but I'm starting to lean towards type errors triggering an exception rather than evaluating to null
.max()
only accepts numbers and I have a list of strings, what's the proper way to convert them to numbers? We could allow the child element of subexpressions to be a function expression, then a user could say: max([].to_number(@))
. This would also handle the case where some of the existing functions have a clause of "all elements that are not of type What do you think?
This has now been merged. Thanks for all your work on this!
Opening a new PR because GitHub stopped syncing the old one for some reason.