Streamlined Method Parameter Declarations
In the pursuit of efficient coding practices, 4D developers commonly configure compilation path settings to enhance syntax and typing checks, thereby minimizing errors during code execution in compile mode. Let’s see how #DECLARE method prototypes will gain time and code security.
A Fresh Approach to Writing Variadic Functions
Many of you are familiar with using methods or functions that can accept an unspecified number of parameters, often referred to as variadic functions.
In our ongoing process to improve your development experience, 4D v20 R3 streamlined the declaration of these methods by introducing ellipsis, making your code more straightforward and easier to work with.
Simplify Variable Declarations & Assignments in a Single Line
Starting with 4D v20 R3, you can wave goodbye to the days of writing multiple lines of code for variable declarations and assignments. Now, you can streamline your code, eliminate redundancy, and easily boost efficiency.
Here is how!
Meet the Updated Print form & FORM LOAD Commands
4D v16 R5 brought a significant improvement to the DIALOG command. An improvement that lays in the possibility of passing a new parameter “formData” of type object. It was great to hear that this new addition has been well received by 4D developers.
With 4D v20, two other commands are upgraded, Print form and FORM LOAD! The benefit will be just as great. The object’s content passed in the parameter will be directly exploitable in the printed forms or forms loaded in memory.
Comparison with an Undefined Value
Since the appearance of ORDA, classes, and other objects, you must work increasingly with undefined values.
Since some of you are asking for an easier way to use them, starting with v20, you can compare any type of value to an undefined value without throwing an error.
Object and Collection Literal Initializer
In your code, objects and collections can be instantiated using New object and New collection commands.
However, starting from 4D v20, a more convenient and readable approach is available using object literals and collection literals. These new features provide a simpler and clearer way to initialize objects and collections.
Support of larger integers than integer32
While Reals are known to be unprecise, they are 100% accurate even for very large numbers, as long as they do not use a decimal point (=integers).
Numbers up to 53 bit, or more exactly, [-(2^53)+1, (2^53)-1], that is a range from −9,007,199,254,740,992 to 9,007,199,254,740,992, will be exactly represented.
Form and subform communication made easy!
Starting with 4D v19 R5, the ability to associate a variable with a subform has enriched the possibilities of interfaces and communication between forms and subforms. The means of communication are now simplified by two new commands: Say hello to OBJECT Get subform container value and OBJECT SET SUBFORM CONTAINER VALUE.
A Seamless Way to Manage Parameters
In the declaration of a function or method, you explicitly define its parameters. Then, when calling that function or method, you can pass fewer parameters to it if some are optional. Or, if you used the declaration with ${n}, the number of passed parameters is variable. In this case, you use the Count Parameters command with a loop over the arguments. This code works flawlessly. Still, it’s a little bit heavy.
You asked us for a lighter way to handle parameters, and we listened. Starting with 4D v19 R5, we provide you with a new command, Copy parameters, allowing you to write a seamless, more elegant, and easier-to-read code.
4D language: The improvements you requested are here
Do you dream of using short-circuit evaluation, ternary operators, breaking free from a loop, or exiting from a method with a simple keyword?
Well, dream no more! We listened and kept an eye on your feature requests from the 4D Forum, so here comes a set of 4D language improvements that will help you simplify your code.
Contact us
Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!
* Your privacy is very important to us. Please click here to view our Policy