First, I like this idea a lot. The language should be helping developers to do things in fewer steps, so anytime something can be added to reduce “time to implement”, I think that’s awesome.
However, since you asked , I have a few thoughts:
- It would seem like a more SQL-like thing would be to use a schema to put the functions under. So instead of
cf_
usecf.
schema. Most modern databases allow you to create a schema to store objects (such as functions), so this would seem like a logical way to handle things. Maybelucee
orcfml
would be a better schema name as well. It might make it easier to find those implementations in the code (or maybecfo
/lfo
(e.g. ColdFusion/Lucee Function Object), to mimic SQL Server’s defaultdbo
schema name). - I would think adding support for an environmental variable to disable this feature would be smart as well. For example, if you use Lucee as your preferred platform, but are trying to code for cross compatibility, it would be good to be warned of code incompatibilities with ACF. So an environmental variable that could be set to throw an exception would be useful. That way you realize you have to do something else for ACF compatibility reasons.
- What’s going to happen to a query that has to fall back to internal HSQL implementation (I think that’s the engine name). I know the code does not work in every situation, and when it can’t handle the SQL it fails back to an actual SQL engine under the hood. I could see how that would be confusing if the functions are only available some of the time. I think if nothing else, we’d need to check if BIF are being used and the fallback SQL implementation is used that we throw an explicit exception that the QoQ cannot be run and why it cannot be run. This could cause some weirdness with people building dynamic QoQ code as well, since this exception might only fire in some corner case scenarios. That could probably be solved by running 2 QoQs (once to the complex join/aggregation) and then another to apply the BIF manipulation.
Anyway, it’s definitely an interesting idea and I can see many uses for it.