Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have two circular reference issues. Firstly you are declaring two units which each refer to the other in the interface section. That can be solved a variety of ways. For now For now I am going to ignore that issue and focus on the other circular reference problem. In order to do so I'm going to assume all code appears in the same unit.</p> <p>The more pressing circular reference problem is that <code>TIns</code> refers to <code>TExtract</code> and vice versa. In order to break this particular circularity you would need to introduce a forward reference, just as is commonly done with classes. But it turns out that forward references cannot be made for <code>record</code> types.</p> <p>Whilst forward references are possible for class types, there is a fundamental difference between class types and record types. Record types are value types and class types are reference types. The current implementation of the Delphi compiler does not support forward references for value types.</p> <p>The solution to your problem is to move the operators that refer to both types to whichever record is declared last. For example:</p> <pre><code>TIns = record private type TInsArray = array [1..90] of Boolean; var FInsArray: TInsArray; end; TExtract = record private type TExtractEnum = 1 .. 90; var FExtractEnum: TExtractEnum; public class operator Implicit(const Value: TExtract): TIns; class operator Implicit(const Value: TIns): TExtract; class operator Implicit(const Value: Integer): TExtract; class operator Implicit(const Value: TExtract): Integer; class operator In(A: TExtract; B: TIns) : Boolean; end; </code></pre> <p>If you wish to retain two separate units then do it like this:</p> <ol> <li>Put <code>TIns</code> in the unit <code>_TIns</code>.</li> <li>Do <strong>not</strong> use <code>_TExtract</code> from <code>_TIns</code>. </li> <li>Put <code>TExtract</code> in the unit <code>_TExtract</code>.</li> <li>Use <code>_TIns</code> from the interface section of <code>_TExtract</code>. </li> </ol> <p>Like this:</p> <pre><code>unit _TIns; interface type TIns = record private type TInsArray = array [1..90] of Boolean; var FInsArray: TInsArray; end; implementation end. </code></pre> <p>&nbsp;</p> <pre><code>unit _TExtract; interface uses _TIns; type TExtract = record private type TExtractEnum = 1 .. 90; var FExtractEnum: TExtractEnum; public class operator Implicit(const Value: TExtract): TIns; class operator Implicit(const Value: TIns): TExtract; class operator Implicit(const Value: Integer): TExtract; class operator Implicit(const Value: TExtract): Integer; class operator In(A: TExtract; B: TIns) : Boolean; end; implementation // Code end. </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload