Suppose you have these definitions:
var Options: array of JavaVMOption; VM_Args: JavaVMInitArgs;
How do you initialize them?
Back in the days, you would use:
Options := nil; FillChar(VM_Args, SizeOf(VM_Args), #0);
These days, you would use:
Options := Default(JavaVMOption); // fail to compile VM_Args := Default(JavaVMInitArgs);
However, Default(JavaVMOption) would fail to compile, because you need to use a type of the variable, not the element of an array that declares the type.
So, you'll rewrite Options as
Options: TArray<JavaVMOption>;
and then
Options := Default(TArray<JavaVMOption>);
You can also use:
Initialize(Options);
In addition, you can also do this, by way of passing a parameter:
procedure DoSomething(out Options: TArray<JavaVMOption>);
In 2017, with the release of Delphi 10.2 Tokyo, Embarcadero introduced a specialized implementation of the Observer pattern into the System.Classes unit. While it has been in the wild for 9 years, it remains a "hidden" architecture for many, primarily because it serves as the invisible engine behind LiveBindings. Other than live bindings, you can also use the Observer pattern as a way to update component settings to the Windows registry, an .ini file, or persist it elsewhere.
System.Classes