#### View Issue Details

ID Project Category View Status Date Submitted Last Update 0035354 FPC Documentation public 2019-04-10 01:43 2019-04-10 11:01 Akira1364 Michael Van Canneyt normal minor always resolved fixed x86_64 Windows 10 3.3.1 41854 3.2.0 3.3.1 0035354: [Patch] Minor addition to the recently added enumerator section in the reference manual, plus a couple of other tweaks. This patch mostly makes it clearer that enumerators can be classes, objects, or advanced records, not just classes. It also adds a note about the enumerator operator not being valid in {\$mode Delphi}, and corrects a misspelling of the word "enumerable". No tags attached. 1597 Attached Files ref.tex.patch (1,783 bytes) Index: ref.tex =================================================================== --- ref.tex (revision 1596) +++ ref.tex (working copy) @@ -9505,14 +9505,14 @@ \item An array value. The loop will be over all elements in the array, and the control variable must have the same type as an element in the array. As a special case, a string is regarded as an array of characters. -\item An enumeratable class instance. This is an instance of a class that -supports the \var{IEnumerator} and \var{IEnumerable} interfaces. +\item An enumerable class, object, or extended record instance. This is an instance of any +structured type that supports the \var{IEnumerator} and \var{IEnumerable} interfaces. In this case, the control variable's type must equal the type of the \var{IEnumerator.GetCurrent} return value. \item Any type for which an \var{enumerator} operator is defined. The -\var{enumerator} operator must return a class that implements the +\var{enumerator} operator must return a structured type that implements the \var{IEnumerator} interface. The type of the control variable's type -must equal the type of the enumerator class \var{GetCurrent} return +must equal the type of the enumerator's \var{GetCurrent} return value type. \end{enumerate} @@ -12045,7 +12045,8 @@ \section{The enumerator operator} The enumerator operator can be used to define an enumerator for any type. -It must return a class that has the same signature as the IEnumerator interface. +It must return a class, object, or extended record that has the same signature as the IEnumerator interface. +Note that this operator is not recognized by the compiler under the Delphi syntax mode. The following code will define an enumerator for the Integer type: \begin{verbatim}  ref.tex.patch (1,783 bytes)

#### Activities

 2019-04-10 01:43 reporter ref.tex.patch (1,783 bytes) Index: ref.tex =================================================================== --- ref.tex (revision 1596) +++ ref.tex (working copy) @@ -9505,14 +9505,14 @@ \item An array value. The loop will be over all elements in the array, and the control variable must have the same type as an element in the array. As a special case, a string is regarded as an array of characters. -\item An enumeratable class instance. This is an instance of a class that -supports the \var{IEnumerator} and \var{IEnumerable} interfaces. +\item An enumerable class, object, or extended record instance. This is an instance of any +structured type that supports the \var{IEnumerator} and \var{IEnumerable} interfaces. In this case, the control variable's type must equal the type of the \var{IEnumerator.GetCurrent} return value. \item Any type for which an \var{enumerator} operator is defined. The -\var{enumerator} operator must return a class that implements the +\var{enumerator} operator must return a structured type that implements the \var{IEnumerator} interface. The type of the control variable's type -must equal the type of the enumerator class \var{GetCurrent} return +must equal the type of the enumerator's \var{GetCurrent} return value type. \end{enumerate} @@ -12045,7 +12045,8 @@ \section{The enumerator operator} The enumerator operator can be used to define an enumerator for any type. -It must return a class that has the same signature as the IEnumerator interface. +It must return a class, object, or extended record that has the same signature as the IEnumerator interface. +Note that this operator is not recognized by the compiler under the Delphi syntax mode. The following code will define an enumerator for the Integer type: \begin{verbatim}  ref.tex.patch (1,783 bytes) 2019-04-10 11:01 administrator   ~0115384 Applied. Thank you, indeed a necessary correction !