With the release of 4D 20 R9, deprecated language elements now generate warnings, helping you keep your code as modern and efficient as possible. Let’s dive into the details.
In 4D 20 R9, new warnings have been introduced for deprecated language elements, including commands, constants, parameters, and typing directives. The following code lines will now trigger these warnings:
C_LONGINT($1)
C_BOOLEAN($draw)
_O_USE INTERNAL DATABASE
$draw:=Is license available(_o_4D Draw license)
You can easily disable these warnings in the structure settings under the Compilation/Warnings page (refer to this blog post for more details).
Although it is still possible to enter them, deprecated commands and constants are no longer suggested in the code completion of code editors (built-in 4D code editor and Visual Studio Code).
To enhance your code introspection, we’ve also extended the Command name command. It now provides information on command deprecation in addition to thread safety details. Here is a simple sample to retrieve a command’s deprecation status:$commandName:=Command name($commandNumber; $info)
$isDeprecated:=($info ?? 1) // Check second bit
Finally, when deprecating commands, we will no longer prefix them with ‘_o_’. However, the deprecation statuses of commands are now explicitly detailed in the 4D Documentation! The new documentation currently does not include deprecated commands, but for all commands that will become deprecated in the future, you will see a banner like this:
We hope this new feature will help you keep your code up to date.
Happy coding!