Yo just reading the docs on <https://docs.lucee.or...
# lucee
a
Yo just reading the docs on https://docs.lucee.org/reference/functions/isempty.html It sez:
• Strings (a zero length string will return
true
)
• Arrays (an array with no elements will return
true
)
• Structs (a struct with no keys will return
true
)
• Query (a query with no rows will return
true
)
It also checks null. Possibly worth mentioning? Am happy to make the change myself unless I'm missing something or it's not actually supposed to? Checking a bit more thoroughly: https://trycf.com/gist/541cd1f2115559fedc6753471aa8e282/lucee5?theme=monokai It also identifies empty XML. And whilst it claims to take "any" type for the parameter value, it doesn't. It errors-out on a function (either defined via a statement or an expression).
d
This is one of the problems with many open source projects. What's the source of truth? The code or the docs? Sometimes code does stuff it's not supposed to do, but often the docs are just outdated. I know maintaining documentation is very time consuming, and with limited resources time is normally focused on the code. My guess is that everything you found is by design and the docs should be updated to reflect your findings.
a
This is my suspicion too. It all seems legit. However I think if the function claims to take
any
then it should not error on some types. Or at least it should not error with "wrong param type", it should error with a CannotDetermineEmptinessException (not that exact name), or just return
false
, and be documented as saying "any other data type eg binaries, functions, etc will return `false`"