Thoughts on this breaking-change for 6.0, I wanna ...
# lucee
z
Thoughts on this breaking-change for 6.0, I wanna make feature detection cleaner (i.e. is ESAPI installed) https://luceeserver.atlassian.net/browse/LDEV-4134
d
@zackster I might be in the minority, but I would prefer a HasBuiltInFunction() function instead. It seems like that's really the information you're after and I could see where that would be useful in some cases.
z
I know what your thinking, I'm just loathe to add yet another bif and namespace
the we add hasExtension and so on
a
If yer calling a function that gets an object (function in this case) by name, and it can't be found... an exception makes the most sense to me. Returning a special-meaningless value just to avoid an exception sounds like a code smell.
"returns and object or false"? Ugh. "Returns a function object... or a null function object..." when there's no real sense of a function object in CFML in the first place... also seems dodgy.
the calling code is still gonna need guard code either way. try/catch or if-null(ish)
So... leave it be, it's better now than the suggestion. The
isObject
thing is a different issue, and should not be part of that ticket.
isObject
returns
true
if the argument is a "CFML object". I take that to mean a CFC instance. So
false
in this case is probably correct?
I know what your thinking, I'm just loathe to add yet another bif and namespace
Don't then. Create a UDF that wraps a call to
GetBuiltInFunction
and has yer try/catch in there, and just call the UDF. No need to change anything.
f
Or this works:
Copy code
getFunctionList().keyExists("encodeForHTML")
never mind that getFunctionList returns a struct not a list 😜