Auto-completion for classes is available since 4D v18 R4. This feature simplifies code writing and limits errors in function names, for example. But it doesn’t avoid them entirely; it’s easy to reverse two letters or to forget a capital letter, and then have to spend time looking for why your code doesn’t work.
So what better way than to ask 4D to check if the classes or functions already exist?
Starting with 4D v19 R4, a warning is displayed in the code editor if you call a function that does not exist.
What’s checked
When declaring or instantiating a class, the class name is checked. Also, the name of the functions is validated for 4D classes, user classes, or user ORDA classes.
And where?
Code editor
As you write your code, if you make a spelling mistake or use the wrong function, a warning will appear to the left of the line.
Compiler window
Like all other 4D warnings, you will find the warnings in the Compiler window.
Compile Project command
Since v19, you can run a “check syntax” by programming thanks to the Compile project command. The status object returned by the command contains all the warnings:
var $options; $status : Object
$options:=New object()
$options.targets:=New collection()
$status:=Compile project($options)
Here are the contents of the $status object:
{ "success": true, "errors": [ {..}, { "message": "The function or property orderby is incompatible with the type driversSelection. (550.2)", "isError": false, "code": { "type": "projectMethod", "methodName": "Method2", "path": "Method2", "file": "[object File]" }, "line": 6, "lineInFile": 7 }] }
And…
Feel free to comment on the 4D forum.