I frequently get an error similar to this:
Can't cast Object type [user defined function (myMethod)] to a value of type [whatever]
Now, I know what this happens, I made a call like:
rc.someObject.myMethod with forgotten parens instead of
rc.someObject.myMethod(). Makes sense - its not a bad error message (it might be nice to say “You probably left off your parens” but I digress).
What if instead though, lucee notices that it is a function and evaluates it instead, then sees what happens? I would venture to say that 9 times out of 10, this error occurs when people are trying to use getters (and 8 our 10 statistics are made up on the spot). Something like
rc.user.getUsername. Would it be possible for lucee to just automatically notice that its a function call and so evaluate it? Then everything just magically works… hopefully even if things are chained:
rc.user.getCompany.getName would work just like:
Now, this of course only works if the function call does not have any required parameters - and if it does then lucee would have to be smart enough to give a proper error message, something similar to to the above - not mask the error message because we were trying to be smart and guess at what the user wanted. If it made things easier I would say it would still be worthwhile if it only worked for methods with no arguments.
Now, all of this said, I would expect there to be some performance penalty - hopefully just at the compile stage but even if it was at runtime I would be willing to accept some slowdowns (to a point) for this.
There might be a case to be made that the syntax might be confusing to someone later on and that the error message is forcing you to write proper code, but im not convinced of that. I don’t expect it would take too much to decipher what is going on.