Introducing Code Live Checker: Elevating Code Quality in 4D Development

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.

blank

  • Another warning is displayed when a non-existent class function is called.

blank

  • When calling a class function, a warning is generated if the number of parameters used exceeds those declared in the prototype.

blank

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.

blank

  • When calling a class function, a warning is generated if the parameter types are incompatible.

blank

ORDA Dataclasses

The use of unknown dataclasses or dataclass attributes now generates an error. This avoids input errors that can generate runtime errors.

blank

CompoNEnts CLASSES

All the behaviors described for classes also apply to shared component classes if the component contains its syntax file.

blank

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!

Avatar
• Product Owner •Damien Fuzeau has joined the 4D Product team in February 2019. As a Product Owner, he is in charge of writing user stories, then translating them to functional specifications. His job also entails making sure that the feature implementations delivered are meeting the customer needs.Damien is graduated from the University of Nantes in software engineering. He spent more than 23 years in its former company, first as developer (discovering 4D in 1997), and later as engineering manager and software architect. This company is a 4D OEM partner and deployed 4D based business softwares for thousands users, on hundreds servers. So, Damien is used to 4D development and deployment in a multi-language context.