Sets and enumerations have been in Delphi since the beginning of Delphi.
Here's an example program. The example program gives the exact output in both Delphi 7 and Delphi 8.
However, if you are using sets or enumerations to talk to other .NET programs, you should be aware that there are some differences that were not documented.
In particular, in Delphi, whatever the value of an enumeration, when it becomes part of a set, the value of an enumeration in the set itself is multiplied by 2.
The differences become fundamental, when you examine how it works in C#, and how it works in Delphi, and you want to talk to a CLR routine using Delphi.
More on that in part 2 of this article. In the meantime, can you figure out the output of the following program?
program SetExamples; {$APPTYPE CONSOLE} uses SysUtils; type ASet = (A1=1, A2=2, A3=4, A4=8, A5=16); ASets = set of ASet; var Set1: ASet; Sets: ASets; begin Set1 := A1; Sets := [Set1]; if A1 in Sets then WriteLn('A1'); if A1 = Set1 then WriteLn('Passed'); WriteLn('Set1 value: ', Ord(Set1)); WriteLn('Sets value: ', Integer(Sets)); end.
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