Stop press! Accessing parameters not being passed is … possible
A method or function can have optional parameters. Sometimes the function is called with two parameters, and other times with three parameters. We’ve all dreamed of accessing the parameters without counting the parameters, checking if the parameter has been passed, or simply not having to check if the variable associated with the parameter has been initialized. This could make the code much simpler, and much more readable, without all the “If” or “Count parameters” lines.
Well, dream no more, and switch to 4D v19 R3! Managing method and function parameters has never been easier.
4D Language – String comparison improvements
The 4D language offers 20+ commands to handle strings. And with 4D v18 R6, 4D introduces a new command: Compare strings. And yet another command has been improved: Position. Both of these commands allow you to use options for more accurate results. Let’s learn more!
Coder-friendly syntax for class functions and methods
Using $1, $2, and $n variables in your code not only makes the code less readable, it can also increase confusion since the human brain can find it difficult to remember what these variables correspond to. The solution is to create a variable with an understandable name and assign it the value of $1, $2, or $n.
4D v18 R5 has good news, you can now name your parameters when declaring:
- a project method,
- a trigger
- a database method
- a form method
- a constructor of a class
- a function of a class.
Let’s see how!
New declaration syntax for an intuitive autocompletion
Have you ever wondered about 4D’s autocompletion feature or asked yourself why 4D suggests all functions used in the code? Since an object is a very generic type, 4D only knows what it’s really storing at runtime. However, that doesn’t help much when you’re writing your code.
4D now offers a new, alternative syntax which will greatly enhance autocompletion when declaring your variables.
C_VARIANT to store different type of values
Sometimes you want to write code being able to work with different variable types, this is especially true for generic coding. Using pointers can make code more difficult to read and debug. Sometimes it’s not possible at all, for example when you want to assign a generic variable to a form object as the data source.
A new command is now at your disposal to let you to declare a variable that can store different types of values. Say hello to the new C_VARIANT command!