4D v20 R4 introduces the Code Live Checker, an algorithm used during Compilation, Syntax Checking, and code typing in the Code Editor. In this blog post, we’ll explore the unique aspects that make this feature useful for 4D developers.
In 4D development, classes are a big improvement.
Now, the Code Live Checker prevents mistakes like typos or logic errors. You can see this checking while you’re typing or during syntax checking and compilation. It’s important to know that this feature only works in classes that use dot notation.
It also gives you new warnings if your code appears inconsistent and creates errors if your code might cause runtime errors.
Classes
An error is generated when the name of a class used does not exist in the ds, cs, or 4D class-stores. This avoids typing errors, particularly those related to case.
Class functions
The Code Live Checker checks several things about class functions.
- A warning is displayed if a parameter declaration is made outside the function prototype.
- Another warning is displayed when a non-existent class function is called.
- When calling a class function, a warning is generated if the number of parameters used exceeds those declared in the prototype.
Types compatibility checking
A type check is now performed in several cases:
- An error is now generated when assigning variables of incompatible types. This also applies to class properties, dataclass attributes, and dataclass computed attributes.
- When calling a class function, a warning is generated if the parameter types are incompatible.
ORDA Dataclasses
The use of unknown dataclasses or dataclass attributes now generates an error. This avoids input errors that can generate runtime errors.
CompoNEnts CLASSES
All the behaviors described for classes also apply to shared component classes if the component contains its syntax file.
Notes
In the 4D code editor, the Code Live Checker is automatically triggered after one second when typing in a method, and when saving in a class.
The 4D compiler may add errors to the error list generated by the Code Live Checker. Unlike Code Live Checker errors, after they have been fixed, these compiler errors remain displayed until the project is compiled again or restarted.
We constantly strive to provide our users with the best possible experience, and we encourage you to share your thoughts and feedback on the 4D forum. Your feedback helps us better understand your needs and continuously improve our products and services.
Happy coding!